Skip to content
Discussion options

You must be logged in to vote

Implemented in v4.2.0:

@ENV_USER = some_username
@ENV_PROJECT = project_name

POST https://httpbin.org/post HTTP/1.1
Content-Type: application/json
Accept: application/json

{
  "project": "{{ENV_PROJECT}}",
  "results": [
    {
      "id": 1,
      "desc": "some_username"
    },
    {
      "id": 2,
      "desc": "another_username"
    }
  ]
}

> {%
client.global.set("AID", response.body.json.results.filter(item => item.desc === request.environment.get("ENV_USER"))[0].id);
%}

###

POST https://httpbin.org/post HTTP/1.1
Content-Type: application/json
Accept: application/json

{
  "id": "{{AID}}"
}

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@svenXY
Comment options

@gorillamoe
Comment options

Comment options

You must be logged in to vote
2 replies
@svenXY
Comment options

@gorillamoe
Comment options

Answer selected by gorillamoe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants