Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HttpResponseSender

Helper class that handles HTTP-based responses.

Hierarchy

  • HttpResponseSender

Index

Methods

Static sendCreatedResult

  • sendCreatedResult(req: any, res: any): function
  • Creates a callback function that sends newly created object as JSON. That callack function call be called directly or passed as a parameter to business logic components.

    If object is not null it returns 201 status code. For null results it returns 204 status code. If error occur it sends ErrorDescription with approproate status code.

    Parameters

    • req: any

      a HTTP request object.

    • res: any

      a HTTP response object.

    Returns function

      • (err: any, result: any): void
      • Parameters

        • err: any
        • result: any

        Returns void

Static sendDeletedResult

  • sendDeletedResult(req: any, res: any): function
  • Creates a callback function that sends deleted object as JSON. That callack function call be called directly or passed as a parameter to business logic components.

    If object is not null it returns 200 status code. For null results it returns 204 status code. If error occur it sends ErrorDescription with approproate status code.

    Parameters

    • req: any

      a HTTP request object.

    • res: any

      a HTTP response object.

    Returns function

      • (err: any, result: any): void
      • Parameters

        • err: any
        • result: any

        Returns void

Static sendEmptyResult

  • sendEmptyResult(req: any, res: any): function
  • Creates a callback function that sends an empty result with 204 status code. If error occur it sends ErrorDescription with approproate status code.

    Parameters

    • req: any

      a HTTP request object.

    • res: any

      a HTTP response object.

    Returns function

      • (err: any): void
      • Parameters

        • err: any

        Returns void

Static sendError

  • sendError(req: any, res: any, error: any): void
  • Sends error serialized as ErrorDescription object and appropriate HTTP status code. If status code is not defined, it uses 500 status code.

    Parameters

    • req: any

      a HTTP request object.

    • res: any

      a HTTP response object.

    • error: any

      an error object to be sent.

    Returns void

Static sendResult

  • sendResult(req: any, res: any): function
  • Creates a callback function that sends result as JSON object. That callack function call be called directly or passed as a parameter to business logic components.

    If object is not null it returns 200 status code. For null results it returns 204 status code. If error occur it sends ErrorDescription with approproate status code.

    Parameters

    • req: any

      a HTTP request object.

    • res: any

      a HTTP response object.

    Returns function

      • (err: any, result: any): void
      • Parameters

        • err: any
        • result: any

        Returns void

Generated using TypeDoc