Skip to content

Specify additional headers #146

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

Closed
emann opened this issue Aug 10, 2020 · 1 comment · Fixed by #148
Closed

Specify additional headers #146

emann opened this issue Aug 10, 2020 · 1 comment · Fixed by #148
Labels
✨ enhancement New feature or improvement

Comments

@emann
Copy link
Collaborator

emann commented Aug 10, 2020

Is your feature request related to a problem? Please describe.
When trying to download a file in chunks, I need to be able to specify the Range header. There is currently no way of specifying any additional headers outside of the call to the provided client's get_headers()

Describe the solution you'd like
There are two ways of going about this, and I feel both have their uses:

  1. Specify custom headers when creating a Client to be used with endpoint functions. This is useful in cases where a header needs to be used/reused frequently. The only downside is this is a bit inconvenient in use cases where the headers aren't used/reused frequently. There could be a set_headers method or something similar, but the easiest way to handle single-use headers would be:
  2. Add a headers: Optional[Dict[str, Any]] param to endpoint functions. This allows headers to be specified on a per-call basis such that using something like the Range header wouldn't require creating a new Client (or updating an existing Client's headers) for each call

I think implementing both would be best. It gives the flexibility of per-call headers, while also allowing users to have clients with a pre-set (albeit updatable) set of headers for easy reuse

@dbanty
Copy link
Collaborator

dbanty commented Aug 10, 2020

@emannguitar there is a way in OpenAPI to declare header parameters. Is the param both declared in the server side and being populated to the document? If so we should just implement #117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants