Skip to content

Provide access to request headers via the headers helper #317

Closed
@cobbr2

Description

@cobbr2

The top-level README.markdown implies at https://github.com/intridea/grape#headers that the headers helper might be used to get the values of headers sent in the HTTP request. It presents the use of the helper and the use of the env as roughly equivalent.

In fact, the helper (Grape::Endpoint#headers) only provides access to headers that have been set by the API; it is also the helper you use to set them.

To access headers in the incoming request, you must use the env method.

I'll rewrite the markdown to clarify that the two examples are addressing two different use cases and submit a pull request -- or is there some intent to unify this access (I don't see a good way to do so, but having unified naming of the keys would certainly make code clearer)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions