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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With