Http_in : access to raw body (string or buffer)

Hello

I'm using an http_in node to receive webhooks that are signed.
My problem is the same as expose here except that my webhooks are not coming from Stripe so I can't use any existing Strip contrib-node

To verify the signature I must apply a signature algorithm to the raw body received from the POST request as a buffer or a string.
But it appears that the http_in node automatically parse the JSON to provide the payload as an object.
It does the same on the msg.req.body field:

image
image

For now I am using a JSON.stringify(), it seems to work for now but there is no guarantee that the parse/stringify operation returns an string exactly matching the original raw body (could be spaces added/removes, ...)

Did I missed something or is it correct that the http_in doesn't provide the raw body "unmodified" ?
If I'm correct it would be a great to provide access to the raw body

Same comment about headers. The doc say that headers are provided in a "headers" sub-object but actually they are only provided in a string array rawHeaders with even index being the header name and odd index being the header value.
image

Thanks

From the help description

payload                                          string | object | buffer
The body of the response. The node can be configured to return the body as a string, attempt to parse it as a JSON string or leave it as a binary buffer.

See the Return drop down

@Buckskin : I'm talking about http_in, not http_request
There is not such drop down in http_in

Apologies, missed that.

Assume you are aware that the body is processed according to content type, no idea if this can be amended in your case.

Hopefully someone more familiar with the node will help

No problem, thanks for looking into my question.

I think we will end up writing a dedicated node from scratch for that

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.