proposed fix: 🐛 add user-agent to allowed headers (firefox cors behaviour) #443
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request addresses the issue outlined here: #391
While the issue arises from a unique combination of Firefox, client-side JavaScript, and a misunderstanding about the use of the user-agent, it doesn't necessarily require a code change. The user-agent is typically replaced by the browser (also true for Firefox), but Firefox requires all headers to be present when explicitly given.
However, to prevent future confusion and potential issue requests, I propose a harmless fix by adding it to the allowed headers as I'm not aware that the user agent is used in any way other than logging.
Alternatively, and perhaps more effectively, one could update the documentation. Specifically, replace the
user-agent
entry in the API recommended practices withX-Via
, or add a note clarifying that setting the user-agent is not necessary for a client-side library. https://www.inaturalist.org/pages/api+recommended+practicesCheers
Hannes