New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setting 'accept' header if 'content-type' header is set to JSON or XML type #643
Comments
@Dylmay Typically, resty understands the JSON and XML marshal/unmarshals. Hence, it notifies the server via the Accept header if it sees content type JSON/XML and the Accept header is empty. Lines 129 to 132 in e12ab69
So, if the user sets the Accept header explicitly, then Resty will not do any action. |
I have encountered the same issue as well. In principle, resty should not set any unexpected header for the user. Users are supposed to set headers themselves, and in some cases, it is necessary not to set certain headers. In the current mode, if users want to avoid setting the User-Agent or Accept header, there is no way to do so. |
The 'accept' header is set if the 'content-type' header is a JSON or XML type which causes unexpected behavior if creating a request like here, where the underlying spec requires a JSON type but the server is not expected to return the same type, or any type, back.
Is there reasoning to set the 'accept' header automatically if it is a JSON or XML type? It seems like the auto-setting of the accept header should be toggle-able by client or the 'accept' header should only auto-set for basic MIME types.
The text was updated successfully, but these errors were encountered: