Home Identifier Source Repository
import Http from 'immutable-http/src/index.js'
public class | source

Http

Http request object. Expose chainable API

Constructor Summary

Public Constructor
public

constructor(params: *)

Member Summary

Public Members
public

Method Summary

Public Methods
public

body(body: Object): Object

Adds body to request model

public

bodyProcessor(bodyProcessor: func): Object

Sets the function which gets the body object as a parameter

public

Executes HTTP request

public

header(header: String, value: String): Object

Adds header to request model

public

method(method: string): Object

Adds HTTP method information to request model

public

query(name: String, value: String): Object

Adds query string param

public

responseType(responseType: String): Object

Sets response content type

public

segment(segment: String, value: String): Object

Adds dynamic segment value

public

url(url: string): Object

Adds URL information to HTTP request model

public
this method was deprecated. since version 0.2.0

Adds body to request model

public

withBodyProccessor(bodyProcessor: func): Object

this method was deprecated. since version 0.2.0

Sets the function which gets the body object as a parameter

public

withDynamicSegment(segment: String, value: String): Object

this method was deprecated. since version 0.2.0

Adds dynamic segment value

public

withHeader(header: String, value: String): Object

this method was deprecated. since version 0.2.0

Adds header to request model

public
this method was deprecated. since version 0.2.0

Predifine body sringification and Content-Type attribute.

public
this method was deprecated. since version 0.2.0

Sets response type to 'json'

public
this method was deprecated. since version 0.2.0

Adds HTTP method information to request model

public

withParam(name: String, value: String): Object

this method was deprecated. since version 0.2.0

Adds query string param

public

withResponseType(responseType: String): Object

this method was deprecated. since version 0.2.0

Sets response content type

public
this method was deprecated. since version 0.2.0

Adds URL information to HTTP request model

Public Constructors

public constructor(params: *) source

Params:

NameTypeAttributeDescription
params *
  • optional
  • default: defaultParams

Public Members

public internals: * source

Public Methods

public body(body: Object): Object source

Adds body to request model

Params:

NameTypeAttributeDescription
body Object

request payload

Return:

Object

Http object

public bodyProcessor(bodyProcessor: func): Object source

Sets the function which gets the body object as a parameter which result would be used as a request body

Params:

NameTypeAttributeDescription
bodyProcessor func

f(x) => valid_http_body

Return:

Object

Http object

public exec(): Object source

Executes HTTP request

Return:

Object

Promise

public header(header: String, value: String): Object source

Adds header to request model

Params:

NameTypeAttributeDescription
header String

valid header key

value String

valid header value

Return:

Object

Http object

public method(method: string): Object source

Adds HTTP method information to request model

Params:

NameTypeAttributeDescription
method string

HTTP method

Return:

Object

Http object

public query(name: String, value: String): Object source

Adds query string param

Params:

NameTypeAttributeDescription
name String

param key

value String

param value

Return:

Object

Http object

public responseType(responseType: String): Object source

Sets response content type Proper values could be obtained form XmlHttpRequest specification https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties

Params:

NameTypeAttributeDescription
responseType String

Proper values could be obtained form XmlHttpRequest specification https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties

Return:

Object

Http object

public segment(segment: String, value: String): Object source

Adds dynamic segment value

Params:

NameTypeAttributeDescription
segment String

segment key

value String

segment value

Return:

Object

Http object

public url(url: string): Object source

Adds URL information to HTTP request model

Params:

NameTypeAttributeDescription
url string

URL

Return:

Object

Http object

public withBody(body: Object): Object source

this method was deprecated. since version 0.2.0

Adds body to request model

Params:

NameTypeAttributeDescription
body Object

request payload

Return:

Object

Http object

public withBodyProccessor(bodyProcessor: func): Object source

this method was deprecated. since version 0.2.0

Sets the function which gets the body object as a parameter which result would be used as a request body

Params:

NameTypeAttributeDescription
bodyProcessor func

f(x) => valid_http_body

Return:

Object

Http object

public withDynamicSegment(segment: String, value: String): Object source

this method was deprecated. since version 0.2.0

Adds dynamic segment value

Params:

NameTypeAttributeDescription
segment String

segment key

value String

segment value

Return:

Object

Http object

public withHeader(header: String, value: String): Object source

this method was deprecated. since version 0.2.0

Adds header to request model

Params:

NameTypeAttributeDescription
header String

valid header key

value String

valid header value

Return:

Object

Http object

public withJsonBody(): Object source

this method was deprecated. since version 0.2.0

Predifine body sringification and Content-Type attribute.

Return:

Object

Http object

public withJsonResponse(): Object source

this method was deprecated. since version 0.2.0

Sets response type to 'json'

Return:

Object

Http object

public withMethod(method: string): Object source

this method was deprecated. since version 0.2.0

Adds HTTP method information to request model

Params:

NameTypeAttributeDescription
method string

HTTP method

Return:

Object

Http object

public withParam(name: String, value: String): Object source

this method was deprecated. since version 0.2.0

Adds query string param

Params:

NameTypeAttributeDescription
name String

param key

value String

param value

Return:

Object

Http object

public withResponseType(responseType: String): Object source

this method was deprecated. since version 0.2.0

Sets response content type Proper values could be obtained form XmlHttpRequest specification https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties

Params:

NameTypeAttributeDescription
responseType String

Proper values could be obtained form XmlHttpRequest specification https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties

Return:

Object

Http object

public withUrl(url: string): Object source

this method was deprecated. since version 0.2.0

Adds URL information to HTTP request model

Params:

NameTypeAttributeDescription
url string

URL

Return:

Object

Http object