question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting parameter from a request

See original GitHub issue

Hi! I’m trying to get a parameter value from an HTTP request that is generated randomly. This is my code:

#create auth user
# @name createUser
POST {{authServiceUrl}}/api/v1/users
content-type: application/json

{
    "email": "test-{{$guid}}@example.com",
    "passwordhash": "XXX"
}

@email = {{createUser.request.body.$.email}}

As a result I get the error:

Unexpected token @ in JSON at position 187

What is the correct way to do it?

Thanks in advance

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
kabraucommented, Jul 6, 2020
### create auth user
# @name createUser
POST {{authServiceUrl}}/api/v1/users
content-type: application/json
 
{
     "email": "test-{{$guid}}@example.com",
     "passwordhash": "XXX"
}

### 
@email = {{createUser.request.body.email}}
  1. Insert ### before @email =
  2. and, in this case, without $
1reaction
ygavrishovcommented, Jul 7, 2020
### create auth user
# @name createUser
POST {{authServiceUrl}}/api/v1/users
content-type: application/json
 
{
     "email": "test-{{$guid}}@example.com",
     "passwordhash": "XXX"
}

### 
@email = {{createUser.request.body.email}}
  1. Insert ### before @email =
  2. and, in this case, without $

Yes, it works!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get parameters from GET request? - Stack Overflow
When you use $.get('EventServe', {location_id: location_id}, ...) to make a HTTP GET request, you are passing the value of location_id as a ...
Read more >
URL Get Parameter - Ryte
The getParameter() method is the HTTP request method most often used to request resources from a server through a client such as a...
Read more >
Python Requests get Method - W3Schools
The get() method sends a GET request to the specified url. ... args means zero or more of the named arguments in the...
Read more >
Request Parameters in Postman - Tools QA
Request Parameters in Postman. 1.Just prepare a GET Request in Postman with the URL www.google.com/search and then click on Params. params.
Read more >
Extracting Request Parameters
Parameters of a resource method may be annotated with parameter-based annotations to extract information from a request. A previous example presented the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found