Skip to content

Request headers #71

@olaven

Description

@olaven

Hi!

As far as I can tell, there is no way to access request headers.
This makes many tasks difficult, e.g. Bearer-tokens.

I propose a solutions where headers are available on the Context-object,
as a Map or [string, string][]. This could be achieved by accessing req.headers
and attaching it to the context.

To clarify, my proposal leads to the following usage:

get("path/to/resource/:id", ({ headers}) => {

    const value = headers.get("header-key"); 
    return `${value} was found on 'header-key'!`
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions