Skip to content
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

Allow usage of "Accept" header on iOS #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

duddu
Copy link

@duddu duddu commented Jan 31, 2017

On iOS, the accepted content-types of the http response are hard-coded in TextResponseSerializer, which makes impossible to customize them without forking the repo.

This commit adds the possibility to extend the Set of the acceptableContentTypes, using the Accept header from the http request. So, any content-type(s) sent in that header will be added to the accepted ones. Without this change, the Accept header would be working as expected on Android, but not on iOS, creating a risky inconsistency.
The fastest way I found to get this done was to pass the header Dictionary to the TextResponseSerializer serializer method, but maybe somebody has a cleaner way to do the same, please have a look.

Warning: just as a reminder, since this code changes the +serializer signature, if new methods are added to CordovaHttpPlugin implementation (e.g with the PR#105), calls to serializer needs to be adapted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant