Query Params in POST request
sergejs-katusenoks opened this issue · 0 comments
sergejs-katusenoks commented
I could not find in documentation if there is a way to use query params in POST request.
Proposal:
If params are present in POST request, then return them in response. This will allow to test POST request for the applications like proxy.
Example request:
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"title": "foo",
"body": "bar",
"userId": 1
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://jsonplaceholder.typicode.com/posts?someParam=someValue&anotherParam=anotherValue", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Example response:
{
"title": "foo",
"body": "bar",
"userId": 1,
"id": 101,
"params": {
"someParam": "someValue",
"anotherParam": "anotherValue"
}
}