Skip to content

Request bodyLimit #4375

@Eomm

Description

@Eomm

Right now, you can set the bodyLimit in two ways:

const app = Fastify({ bodyLimit: serverLimit })

app.post('/route-limit', {
  bodyLimit: routeLimit,
  handler (req) { return req.rawBody }
})

A custom ContentTypeParser or a preParsing hook function:

  • can access the serverLimit via app.initialConfig.bodyLimit
  • can't access the routeLimit unless a private API request.context._parserOptions.limit

I think we should add a getter request.routeBodyLimit that returns the custom routeLimit || serverLimit

WDYT?

Ref Eomm/fastify-raw-body#35

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions