send(body) {

    // Generate Etag
    if (this._etag // if etag support enabled
      && ['GET', 'HEAD'].includes(this._request.method)
      && !this.hasHeader('etag')
      && this._statusCode === 200
    ) {
      this.header('etag', '"' + UTILS.generateEtag(body) + '"')
    }

    // Check for matching Etag
    if (
      this._request.headers['if-none-match']
      && this._request.headers['if-none-match'] === this.getHeader('etag')
    ) {
      this.status(304)
      body = ''
    }

    // Create the response
    this._response = Object.assign({},
      this._request._multiValueSupport ? { multiValueHeaders: this._headers }
        : { headers: UTILS.stringifyHeaders(this._headers) },
      {
        statusCode: this._statusCode,
        body: this._request.method === 'HEAD' ? '' : UTILS.encodeBody(body, this._serializer),
        isBase64Encoded: this._isBase64
      },
      this._request.interface === 'alb' ? { statusDescription: `${this._statusCode} ${UTILS.statusLookup(this._statusCode)}` } : {}
    )

    if (this.app._provider === 'awsEdge') {
      this._response = createEdgeResponse(this._response);
    }
    // Trigger the callback function
    this.app._callback(null, this._response, this)

  } // end send
// Sends the request to the main callback
Sends the request to the main callback
Sends the request to the main callback
send(body) {
    if (this._etag 
      && ['GET', 'HEAD'].includes(this._request.method)
      && !this.hasHeader('etag')
      && this._statusCode === 200
    ) {
      this.header('etag', '"' + UTILS.generateEtag(body) + '"')
    }
    if (
      this._request.headers['if-none-match']
      && this._request.headers['if-none-match'] === this.getHeader('etag')
    ) {
      this.status(304)
      body = ''
    }
    this._response = Object.assign({},
      this._request._multiValueSupport ? { multiValueHeaders: this._headers }
        : { headers: UTILS.stringifyHeaders(this._headers) },
      {
        statusCode: this._statusCode,
        body: this._request.method === 'HEAD' ? '' : UTILS.encodeBody(body, this._serializer),
        isBase64Encoded: this._isBase64
      },
      this._request.interface === 'alb' ? { statusDescription: `${this._statusCode} ${UTILS.statusLookup(this._statusCode)}` } : {}
    )
    if (this.app._provider === 'awsEdge') {
      this._response = createEdgeResponse(this._response);
    }
    this.app._callback(null, this._response, this)
  } 
send ( body ) { if ( this . _etag && [ 'GET' , 'HEAD' ] . includes ( this . _request . method ) && ! this . hasHeader ( 'etag' ) && this . _statusCode === 200 ) { this . header ( 'etag' , '"' + UTILS . generateEtag ( body ) + '"' ) } if ( this . _request . headers [ 'if-none-match' ] && this . _request . headers [ 'if-none-match' ] === this . getHeader ( 'etag' ) ) { this . status ( 304 ) body = '' } this . _response = Object . assign ( { } , this . _request . _multiValueSupport ? { multiValueHeaders : this . _headers } : { headers : UTILS . stringifyHeaders ( this . _headers ) } , { statusCode : this . _statusCode , body : this . _request . method === 'HEAD' ? '' : UTILS . encodeBody ( body , this . _serializer ) , isBase64Encoded : this . _isBase64 } , this . _request . interface === 'alb' ? { statusDescription : ` ${ this . _statusCode } ${ UTILS . statusLookup ( this . _statusCode ) } ` } : { } ) if ( this . app . _provider === 'awsEdge' ) { this . _response = createEdgeResponse ( this . _response ) ; } this . app . _callback ( null , this . _response , this ) }
Sends the request to the main callback
Sends the request to the main callback
// Generate Etag // if etag support enabled // Check for matching Etag // Create the response // Trigger the callback function // end send