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

fix: remove custom rawBody interface from request invoker #263

Closed
wants to merge 1 commit into from

Conversation

grant
Copy link
Contributor

@grant grant commented Mar 31, 2021

Removes the added rawBody field from requests.

This is used in the body-parser verify callback hook (it doesn't actually verify the payload).

I'm not sure exactly the history around this field. The field, req.rawBody is there when testing in GCF, and it stores the JSON HTTP POST body in a byte array.

Example request:

 curl -XPOST https://us-central1-....cloudfunctions.net/function-26 -H "content-type: application/json" -d '{ "name": "fo" }'

Example response (that you need to parse):

JSON.parse("{\"type\":\"Buffer\",\"data\":[123,32,34,110,97,109,101,34,58,32,34,102,111,34,32,125]}")

Fixes #198

This would be a breaking change.

@google-cla google-cla bot added the cla: yes label Mar 31, 2021
@grant grant requested a review from mtraver March 31, 2021 01:05
@grant
Copy link
Contributor Author

grant commented Mar 31, 2021

I think we actually just need to document the reason for this a bit more and perhaps update the interface.

The reason for this is described here:

https://flaviocopes.com/express-get-raw-body/

@grant grant closed this Mar 31, 2021
@grant grant deleted the grant_remove_rawbody branch March 31, 2021 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implicit Request interface extension causes error 'property rawBody does not exist on type'
1 participant