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

Good practice to handle Accept header case ? #198

Open
inkhey opened this issue May 13, 2020 · 0 comments
Open

Good practice to handle Accept header case ? #198

inkhey opened this issue May 13, 2020 · 0 comments
Labels

Comments

@inkhey
Copy link
Contributor

inkhey commented May 13, 2020

Hello, I was trying to use pyramid with hapic and marshmallow, and i do wanted to validate that origin user do accept "text/event-stream" as response using the Accept header.

My naive approach was to use @hapic.input_header()
and OneOf validator of marshmallow with one value "text/event-stream".
It's working, but i check spec of Accept:
https://developer.mozilla.org/fr/docs/Web/HTTP/Headers/Accept
i should also accept many complex case like:

  • */*
  • text/*
  • text/event-stream, text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant