bruno icon indicating copy to clipboard operation
bruno copied to clipboard

Add context to request execution

Open tlaloc911 opened this issue 1 year ago • 0 comments

I have the need to now the execution context of the request:

  1. Name of the Request executed
  2. Path of the .bru name
  3. Execution mode: single, runner, cli
  4. Associated documentation of the request

This will allow me to take some decisions in scripts, such as how to name logs, where to find data associated to every request, apply or exclude some tests depending on the way it is launched, etc.

Pre Request script example

console.log("-------- executionMode ----------")
console.log(bru.getVar("executionMode"))
console.log("-------- pathname ----------")
console.log(bru.getVar("currentItem").pathname)
console.log("-------- filename ----------")
console.log(bru.getVar("currentItem").filename)

Outputs

image image image

I am preparing a PR with this solution

tlaloc911 avatar Mar 21 '24 00:03 tlaloc911