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

Support for header parameters #5

Open
zverok opened this issue Jan 20, 2018 · 2 comments
Open

Support for header parameters #5

zverok opened this issue Jan 20, 2018 · 2 comments

Comments

@zverok
Copy link
Contributor

zverok commented Jan 20, 2018

As discussed in #4.

Some APIs require passing parameter in headers (especially often with auth.params), it should be supported this way:

# ...somewhere inside API description
param :jwt_token, format: ->(token) { "Bearer: #{@jwt_token}" }, header: 'Authorization'

# ...

# usage:
client = SomeApiClient.new(jwt_token: "some_token")
client.some_method
@danielpuglisi
Copy link

Hi zverok. First of all, thanks for creating this wonderful gem. I'm currently building an API and was researching how to wrap it into a ruby client until I stumbled upon your gem. I also need header support. But that's not why I'm commenting.

I'm using https://github.com/basecamp/geared_pagination for pagination purposes which returns pagination information in the response header. I was wondering where to tap into the response object within your code to actually achieve this?

@zverok
Copy link
Contributor Author

zverok commented Jan 27, 2019

Hi @danielpuglisi , sorry for the late answer.
In current codebase, the place is here: https://github.com/molybdenum-99/tlaw/blob/master/lib/tlaw/endpoint.rb#L79 (it even marked with a TODO for that :))

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

No branches or pull requests

2 participants