Reputation: 31
I need to send parameters through HTTP GET request. Since my HTTP client has to be generic, I am adding the parameters as query parameter (?key=value&k=v)
and also as request header (key: value)
.
Is this a good approach? Will the server looking for header ignore query parameters or vice versa?
Please suggest.
Upvotes: 3
Views: 8479
Reputation: 68725
As per the convention, you should set the request parameter for GET request in the query string. Headers are used for passing message/meta information along with the request. So use headers to set that information only, such as Content-Type,Accept.
Avoid mixing the headers and request params.
Upvotes: 5