-
Notifications
You must be signed in to change notification settings - Fork 963
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
Pass options to dynamic block headers #661
Pass options to dynamic block headers #661
Conversation
lib/httparty.rb
Outdated
end | ||
end | ||
|
||
def process_dynamic_headers(headers) | ||
headers.each_with_object({}) do |header, processed_headers| | ||
def process_dynamic_headers(options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to move it to a separate class? Something like HeaderProcessor
. I don't really like that we do everything in a base class. Additionally, the method became more complex, so it's justified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheSmartnik please preview code with extracted HeadersProcessor class
508f504
to
b9df779
Compare
b9df779
to
1d8d0a7
Compare
private | ||
|
||
def process_dynamic_headers | ||
options[:headers].each_with_object({}) do |header, processed_headers| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just, fyi. You can do |(key, value), processed_headers|
@wojw5 thanks! I like what you did here, looks nice |
@TheSmartnik Do you think this is enough to bump version and do gem release? I have another gem that depends on this feature and i will release it to RubyGems once this dependency will be on RubyGems as well. |
I encountered the following problem: API required checksum based on the request body.
This simple change allows using request options in block header like in this example: