Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Request body support for JS expressions #3768

Closed
leonardschneider opened this issue Nov 9, 2017 · 3 comments
Closed

Feature request: Request body support for JS expressions #3768

leonardschneider opened this issue Nov 9, 2017 · 3 comments

Comments

@leonardschneider
Copy link

It would be great if the request body could support JS expressions, so we could do things like:

{
  "number": `1 +2`,
  "string": `"hello"`,
  "null": `null`,
  "array": `[1, 2, 3]`,
  "ignoredOptional": `undefined`,
  "randomIntBetween0And1000": `Math.floor(Math.random() * 1000)`,
  "globalVariableDerivation": `pm.globals.get("count") + 3`
}

If the result of the evaluation is undefined, then the whole field is ignored.

@leonardschneider leonardschneider changed the title Request body support for JS expressions Feature request: Request body support for JS expressions Nov 9, 2017
@sdnts
Copy link

sdnts commented Nov 14, 2017

@leonardschneider Thanks for the request! We will try to look into supporting more ES6 JS features. I'll let you know here when we make progress.

@codenirvana
Copy link
Member

@leonardschneider I understood your use case, this can be achieved using the variables.

I feel we misunderstood this feature request initially as JS expressions can't be evaluated directly in the request body.

@shamasis
Copy link
Member

This use-case can now be achieved using editable requests from pre-request scripts programmatically. Albeit this specific need to edit "body" is not yet supported. But is in the roadmap in short to mid term.

The same is being tracked at: #4808

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants