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.

[Question] Use GET request parameters in response?

See original GitHub issue

Hi,

I want to use WireMock to mock the backend for my app. Just a simple question: Is it possible to use parameter values of my get request in my response?

Example: If I send a request like

"/api/events\\?date=*"

I would like to response a JSON like:

{
   "events":{
      "event":{
         "name":"event1",
         "date":"[date]"
      },
      "event":{
         "name":"event2",
         "date":"[date+1]"
      },
      "event":{
         "name":"event3",
         "date":"[date+2]"
      }

[date] should be replaced by the value from the request. Is this possible using WireMock?

Thanks for the great tool and your answer 😉

Yours sincerely Illaz

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
pmendelskicommented, Apr 28, 2016

IMHO the second option is much easier/better.

1reaction
tomakehurstcommented, Apr 28, 2016

Additionally there’s the option of a really basic templating engine (e.g. StringTemplate) so that you can replace properties:

{
  "myHeaderValue": '$$request.headers.X-My-Header$$'
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Request Parameters in Postman - Tools QA
Request parameter starts with a question mark (?). Request parameters follow "Key=Value" data format. In our example "q" is the Key and "ToolsQA ......
Read more >
How to send parameters in requests.get() with hashtag ...
So requests strictly do what you say, it generates query parameters via params key. When you need custom fragment do it yourself:
Read more >
REST API Best Practices for Parameter and Query String Usage
Parameters are options you can send to the endpoint to modify the response (for example, selecting the response format or the amount returned)....
Read more >
REST API Design Best Practices for Parameter and Query ...
There are many ways in HTTP to add parameters to our request: the query string, the body of POST, PUT and PATCH requests,...
Read more >
Passing Information via Query Strings - Qualtrics
How to Use Q_PopulateResponse. Q_PopulateResponse is used as a URL parameter to pre-populate survey responses. Values are passed through the URL as JSON ......
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