Skip to content

Add HEADERS variable to the Rook request environment#143

Merged
alandipert merged 5 commits into
masterfrom
alan-raw_headers
Jun 14, 2018
Merged

Add HEADERS variable to the Rook request environment#143
alandipert merged 5 commits into
masterfrom
alan-raw_headers

Conversation

@alandipert

@alandipert alandipert commented May 24, 2018

Copy link
Copy Markdown
Contributor

Fixes #141

TODO:

  • NEWS
  • Reference documentation

@wch

wch commented May 24, 2018

Copy link
Copy Markdown
Collaborator

Some notes:

  • The req object now includes an item req$HEADERS, which is a named character vector.
  • The names are all lowercase, since the HTTP spec says that capitalization does not matter, and making it all lowercase makes it easier to consistently index into.
  • The order of headers is not preserved, also in keeping with the HTTP spec.
  • If multiple headers have the same name, as in:
    foo: 123
    FOo: 456
    
    then they will be collapsed into a single value (req$HEADERS[["foo"]] == "123,456"), separated by a comma, and preserving the order. This is also what the HTTP spec says.

@jeroen

jeroen commented Jun 1, 2018

Copy link
Copy Markdown
Contributor

Thanks this is great! Thank you!

@jeroen

jeroen commented Jun 1, 2018

Copy link
Copy Markdown
Contributor

Make sure you test this on CentOS 6 though, some old compilers have trouble with iterators.

@alandipert

Copy link
Copy Markdown
Contributor Author

@jeroen thank you for the feedback, I'm glad you like it!

Since making the PR we've become somewhat ambivalent about adding this now, since the info was already available, albeit in an inconvenient form. We (@jcheng5 and @wch and I) discussed passing for now, and instead holding out for a possible overhaul of the httpuv API that could include it.

What are you using it for? Would this be really helpful to you now, or would you be willing to wait?

Thanks in advance for sharing your perspective.

@jeroen

jeroen commented Jun 1, 2018

Copy link
Copy Markdown
Contributor

I would like to use it for unit testing http requests in the curl package. What's the reason not to include it? It seems like a trivial non-breaking change?

@alandipert

Copy link
Copy Markdown
Contributor Author

Thanks for your input @jeroen, scratch what I said, we're going to move forward with this 😄 I'll do the CentOS 6 testing in the very near future.

@jeroen

jeroen commented Jun 1, 2018

Copy link
Copy Markdown
Contributor

Just checked in my centos 6 vm and all seems good !

@alandipert

Copy link
Copy Markdown
Contributor Author

@wch when you have a chance can you please look at the NEWS and documentation additions and let me know if they're good?

@wch wch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's good, feel free to merge!

@alandipert alandipert merged commit fb08323 into master Jun 14, 2018
@alandipert alandipert deleted the alan-raw_headers branch June 14, 2018 04:38
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.

3 participants