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

Demo using Protocol::HTTP::AcceptEncoding #73

Closed
wants to merge 2 commits into from

Conversation

trevorturk
Copy link
Contributor

Description

Documentation re: #68

@ioquatix I ran into trouble testing this change -- likely I'm doing something wrong, but I found sending the headers as a hash worked, but as an array did not. I'm hoping you can have a look to see what went wrong, or what I'm doing wrong!

Types of Changes

  • Documentation
  • Test script (to be removed) demonstrating headers in a hash works, but in an array doesn't

Testing

  • Needs test script fixed and removed

README.md Outdated
Async do
internet = Async::HTTP::Internet.new
url = "http://httpbin.org/gzip"
headers = ["accept-encoding", "gzip"] # or {"accept-encoding" => "gzip"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is it should be an Array of Array(key, value).

Similar to {'accept-encoding': 'gzip'}.to_a => [[:"accept-encoding", "gzip"]]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, of course: fixed in 72ce63b

@trevorturk trevorturk marked this pull request as ready for review April 23, 2021 23:04
@trevorturk
Copy link
Contributor Author

This is ready to go, but I'm not sure if you'll like the documentation style with the two examples combined. Please feel free to suggest changes or of course feel free to tweak as you like!

@ioquatix
Copy link
Member

You don't need to manually add the headers, it will automatically add them: https://github.com/socketry/protocol-http/blob/master/lib/protocol/http/accept_encoding.rb#L48

@trevorturk
Copy link
Contributor Author

Closing since this is entirely automatic!

@trevorturk trevorturk closed this Apr 24, 2021
@trevorturk trevorturk deleted the accept-encoding branch April 24, 2021 04:02
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

Successfully merging this pull request may close these issues.

None yet

2 participants