Skip to content

Compatibility with preParsing / onRequest hooks#620

Description

@tmcw

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

馃殌 Feature Proposal

As far as I can tell, this plugin reads from request.raw:

const request = this.raw

In my usecase, which is verifying webhook signatures from Sendgrid, I'll need to have the raw binary body so that the webhook can be verified, but then parse the body as multipart. Getting both of these right does not appear to be possible with how fastify-multipart is set up right now.

If I use preParsing and read the request stream to verify it, then this plugin looks and finds the request stream empty and closed by the time it gets to the verification hook.

Motivation

Making this plugin more intuitive to use with other hooks - it did not occur to me for a long time that my preParsing hook which followed documented patterns would not work because this plugin was reading from req.raw instead of reading the payload stream.

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions