[Question] Use GET request parameters in response?
See original GitHub issueHi,
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:
- Created 10 years ago
- Comments:14
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
IMHO the second option is much easier/better.
Additionally there’s the option of a really basic templating engine (e.g. StringTemplate) so that you can replace properties: