Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RequestBody

Hierarchy

  • RequestBody

Index

Methods

asJsonArray

  • asJsonArray(maxAllowedLength: number): any[] | null
  • asJsonArray(): any[] | null
  • Gets the current body buffer as a . If a positive limit is provided the parsing will only happen if the buffer length is smaller or equal to the limit. Otherwise an IllegalStateException is thrown.

    When the application is only handling uploads in JSON format, it is recommended to set a limit on {@link BodyHandler#setBodyLimit} as this will avoid the upload to be parsed and loaded into the application memory.

    Parameters

    • maxAllowedLength: number

    Returns any[] | null

  • Returns any[] | null

asJsonObject

  • asJsonObject(maxAllowedLength: number): {} | null
  • asJsonObject(): {} | null
  • Gets the current body buffer as a . If a positive limit is provided the parsing will only happen if the buffer length is smaller or equal to the limit. Otherwise an IllegalStateException is thrown.

    When the application is only handling uploads in JSON format, it is recommended to set a limit on {@link BodyHandler#setBodyLimit} as this will avoid the upload to be parsed and loaded into the application memory.

    Parameters

    • maxAllowedLength: number

    Returns {} | null

  • Returns {} | null

asPojo

  • asPojo<R>(clazz: any, maxAllowedLength: number): R | null
  • asPojo<R>(clazz: any): R | null
  • Type parameters

    • R

    Parameters

    • clazz: any
    • maxAllowedLength: number

    Returns R | null

  • Type parameters

    • R

    Parameters

    • clazz: any

    Returns R | null

asString

  • asString(): string | null
  • asString(encoding: string): string | null
  • Returns string | null

  • Get the entire HTTP request body as a string, assuming the specified encoding. The context must have first been routed to a BodyHandler for this to be populated.

    Parameters

    • encoding: string

    Returns string | null

available

  • available(): boolean
  • Return true if a BodyHandler was executed before this call in the lifetime of the request.

    Returns boolean

buffer

  • buffer(): Buffer | null
  • Returns Buffer | null

isEmpty

  • isEmpty(): boolean
  • A body can be empty if it is not available, or its length is 0.

    Returns boolean

length

  • length(): number
  • Returns the total length of the body buffer. This is the length in bytes. When there is no buffer the length is -1.

    Returns number

Generated using TypeDoc