Generates Allow, Accept-Patch, Accept-Post, and Accept-Put headers. The resulting values depend on the choses input methods and types. The input metadata also gets used to remove methods from that list if they are not valid in the given situation.

Hierarchy

Constructors

Properties

acceptTypes: { patch: string[]; post: string[]; put: string[] }

Type declaration

  • patch: string[]
  • post: string[]
  • put: string[]
supportedMethods: string[]

Methods

  • Generates the Accept-[Method] headers if required. Will be added if the Allow header was added, or in case of a 415 error. Specific Accept-[Method] headers will only be added if the method is in the methods set.

    Parameters

    Returns void

  • Generates the Allow header if required. It only needs to get added for successful GET/HEAD requests, 404s, or 405s. The spec only requires it for GET/HEAD requests and 405s. In the case of other error messages we can't deduce what the request method was, so we do not add the header as we don't have enough information.

    Parameters

    Returns boolean