Class AllowAcceptHeaderWriter

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.




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

Type declaration

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


  • Checks whether the input can be handled by this class. If it cannot handle the input, rejects with an error explaining why.


    Returns Promise<void>

    A promise resolving if the input can be handled, rejecting with an Error if not.

  • 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.


    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.


    Returns boolean

  • DELETE is allowed if the target exists, is not a container, or is an empty container that isn't a storage.

    Note that the identifier value check only works if the metadata is not about an error.


    Returns boolean