W3cubDocs

/Angular 2 TypeScript

Headers

Experimental Class

Class Overview

class Headers {
  static fromResponseHeaderString(headersString: string) : Headers
  constructor(headers?: Headers|{[name: string]: any})
  
  
  append(name: string, value: string) : void
  delete(name: string) : void
  forEach(fn: (values: string[], name: string, headers: Map<string, string[]>) => void) : void
  get(name: string) : string
  has(name: string) : boolean
  keys() : string[]
  set(name: string, value: string|string[]) : void
  values() : string[][]
  toJSON() : {[name: string]: any}
  getAll(name: string) : string[]
  entries()
}

Class Description

Constructor

constructor(headers?: Headers|{[name: string]: any})

Static Members

fromResponseHeaderString(headersString: string) : Headers

Returns a new Headers instance from the given DOMString of Response Headers

Class Details

append(name: string, value: string) : void

Appends a header to existing list of header values for a given header name.

delete(name: string) : void

Deletes all header values for the given name.

forEach(fn: (values: string[], name: string, headers: Map<string, string[]>) => void) : void
get(name: string) : string

Returns first header that matches given name.

has(name: string) : boolean

Checks for existence of header by given name.

keys() : string[]

Returns the names of the headers

set(name: string, value: string|string[]) : void

Sets or overrides header value for given name.

values() : string[][]

Returns values of all headers.

toJSON() : {[name: string]: any}

Returns string of all headers.

getAll(name: string) : string[]

Returns list of header values for a given name.

entries()

This method is not implemented.

exported from @angular/http/index, defined in @angular/http/src/headers.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/http/index/Headers-class.html