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

Expose more in RequestContext #127

Closed
kevmoo opened this issue Dec 22, 2020 · 4 comments · Fixed by #150
Closed

Expose more in RequestContext #127

kevmoo opened this issue Dec 22, 2020 · 4 comments · Fixed by #150
Assignees
Labels
kind/enhancement New feature or request
Milestone

Comments

@kevmoo
Copy link
Collaborator

kevmoo commented Dec 22, 2020

We can't (er, shouldn't?) expose the entire Request because we read the body.

But that leaves some things not accessible to custom and CloudEvent handlers

Including:

  • requestedUri
  • HTTP method
  • protocol version

Follow-up to #108

@kevmoo kevmoo added the kind/enhancement New feature or request label Dec 22, 2020
@subfuzion
Copy link
Member

Perhaps it's best to simply document that accessing the body is an error since the stream has already been read?

@kevmoo
Copy link
Collaborator Author

kevmoo commented Dec 22, 2020

Perhaps it's best to simply document that accessing the body is an error since the stream has already been read?

Yeah. That makes this all a lot easier. Hrm...

Is there any (good) reason to hide the request otherwise?

@subfuzion
Copy link
Member

I'm familiar with middleware (like the express json middleware) replacing the request body after parsing the stream so that it can be accessed. Since body is dynamic, can our wrapper (or can we create a wrapper to) override?

@subfuzion
Copy link
Member

subfuzion commented Dec 22, 2020

But if I understood your question correctly, I don't think we can anticipate all the reasons why someone wants access to the raw request, so I don't recommend making it completely inaccessible. However, it might not be bad to explore the idea of using a scope as @simolus3 suggested here (although for a different reason), to make the request object a bit less conspicuous (only need to be aware about it if you really want it)...

@kevmoo kevmoo added this to the v0.4.0 milestone Dec 27, 2020
@kevmoo kevmoo self-assigned this Dec 27, 2020
kevmoo added a commit that referenced this issue Dec 27, 2020
Deprecated headers and headersAll

Fixes #127
kevmoo added a commit that referenced this issue Dec 27, 2020
Deprecated headers and headersAll

Fixes #127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants