Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface FaaSHTTPResponse

Hierarchy

Properties

body

body: any

Get/Set response body.

etag

etag: string

Get/Set the ETag of a response. This will normalize the quotes if necessary.

this.response.etag = 'md5hashsum';
this.response.etag = '"md5hashsum"';
this.response.etag = 'W/"123456789"';
param
api

public

header

header: object

Return response header.

Type declaration

  • [key: string]: any

headers

headers: object

Return response header, alias as response.header

Type declaration

  • [key: string]: any

lastModified

lastModified: Date

Get the Last-Modified date in Date form, if it exists. Set the Last-Modified date using a string or a Date.

this.response.lastModified = new Date();
this.response.lastModified = '2013-09-13';

length

length: number

Return parsed response Content-Length when present. Set Content-Length field to n.

status

status: number

Get/Set response status code.

type

type: string

Return the response mime type void of parameters such as "charset".

Set Content-Type response header with type through mime.lookup() when it does not contain a charset.

Examples:

this.type = '.html';
this.type = 'html';
this.type = 'json';
this.type = 'application/json';
this.type = 'png';

Methods

append

  • append(field: string, val: string | string[]): void

get

  • get(field: string): string
  • Return response header. If the header is not set, will return an empty string.

    The Referrer header field is special-cased, both Referrer and Referer are interchangeable.

    Examples:

    this.get('Content-Type');
    // => "text/plain"
    
    this.get('content-type');
    // => "text/plain"
    
    this.get('Something');
    // => ''
    

    Parameters

    • field: string

    Returns string

is

  • is(...types: string[]): string
  • is(types: string[]): string

redirect

  • redirect(url: string, alt?: string): void

remove

  • remove(field: string): void

set

  • set(field: object): void
  • set(field: string, val: string | string[]): void

Generated using TypeDoc