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

Siren Requests should be made with the header "Accept: application/vnd.siren+json" #7

Closed
tomdottom opened this issue Nov 28, 2015 · 1 comment

Comments

@tomdottom
Copy link
Contributor

Currently the HypermediaClient will not work with any apis supporting both application/json and application/vnd.siren+json

Siren api requests should be made with the "Accept: application/vnd.siren+json" header.

A solution could be to add an option to set the type to the HypermediaClient constructor.
Alternatively SirenClient could be used when explicitly expecting to use application/vnd.siren+json.

A currently workaround is to ensure the request factory is always providing the correct headers.

from functools import partial
import requests

headered_req = partial(requests.Request, headers={'Accept': 'application/vnd.siren+json'})
client = HypermediaClient.connect('http://myapi.io/items/', request_factory=headered_req)
@timmartin19
Copy link
Member

Fixed by #3

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

No branches or pull requests

2 participants