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

Headers refactoring #25

Closed
wants to merge 5 commits into from
Closed

Headers refactoring #25

wants to merge 5 commits into from

Conversation

paneq
Copy link
Collaborator

@paneq paneq commented Jul 18, 2012

Normalize accessing them with downcased string. Expose mongrel2 headers as request methods. Remove such headers from the list.

end

class Request < BaseRequest
include Upload
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would love to use prepend from Ruby 2.0 instead ...

def rackify(env = {})
inject(env) do |rack, (header, value)|
key = "HTTP_" + header.upcase.gsub("-", "_")
env[key] = value
Copy link
Owner

Choose a reason for hiding this comment

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

You need to end an inject with the object you want to pass into the next invocation. In this case, it'd be +rack+. However, you're not using the result of the inject, so use an each instead.

@perplexes
Copy link
Owner

Merged #26, thanks guys.

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