Ravi Kiran
Ravi Kiran

Reputation: 31

Http GET request parameter as query parameter and header

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

Answers (1)

Juned Ahsan
Juned Ahsan

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

Related Questions