Class BodyUsedError

Whenever you try to call authenticator.authenticate("form", request) and the request's body was already read before, the FormStrategy will throw this error.

To fix it, ensure that you either move the logic that depends on the body to inside the strategy's verify callback, or clone the request before reading.

Example

let formData = await request.clone().formData()
// do something with formData
let user = await authenticator.authenticate("form", request);

Example

authenticator.use(
new FormStrategy(async ({ form }) => {
// do something with form here
}),
"login",
);

Hierarchy

Constructors

Properties

cause?: unknown
message: string
name: string = "BodyUsedError"
stack?: string
prepareStackTrace?: ((err, stackTraces) => any)

Optional override for formatting stack traces

Type declaration

    • (err, stackTraces): any
    • Parameters

      • err: Error
      • stackTraces: CallSite[]

      Returns any

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void