# RequestModule

## request. RequestModule

#### new RequestModule()

Source:
  - constructors/request.js, line 3

### Members

#### (static) READY_STATE_DONE :number

Source:
  - constructors/request.js, line 469
Default Value:
  - 4

Downloading is done

##### Type:

- number

#### (static) READY_STATE_HEADERS_RECEIVED :number

Source:
  - constructors/request.js, line 455
Default Value:
  - 2

send() has been called, and headers and status are available.

##### Type:

- number

#### (static) READY_STATE_LOADING :number

Source:
  - constructors/request.js, line 462
Default Value:
  - 3

Downloading; responseText holds partial data.

##### Type:

- number

#### (static) READY_STATE_OPENED :number

Source:
  - constructors/request.js, line 448
Default Value:
  - 1

open() has been called.

##### Type:

- number

#### (static) READY_STATE_UNSENT :number

Source:
  - constructors/request.js, line 441
Default Value:
  - 0

Client has been created. open() not called yet.

##### Type:

- number

### Methods

#### async() → {RequestModule.RequestConfig.async}

Source:
  - constructors/request.js, line 504
See:
  - module:request.RequestModule.RequestConfig

##### Returns:

Type
  RequestModule.RequestConfig.async

#### async(status) → {RequestModule}

Source:
  - constructors/request.js, line 510

##### Parameters:

Name | Type | Description
--- | --- | ---
`status` | boolean | enable/disable XMLHttpRequest async mode

##### Returns:

Type
  RequestModule

#### config() → {RequestModule.RequestConfig}

Source:
  - constructors/request.js, line 98

##### Returns:

Type
  RequestModule.RequestConfig

#### configurator(template) → {RequestModule}

Source:
  - constructors/request.js, line 107

##### Parameters:

Name | Type | Description
--- | --- | ---
`template` | 'multipart' | 'blob' | 'binary' | 'POST' | 'prepare-multipart' | 'retrieve-blob' | 'retrieve-binary-string' | 'prepare-post' | 'check-status-code' | 'ignore-status-code' | configuration name

##### Returns:

Type
  RequestModule

#### headers(name, value) → {RequestModule}

Source:
  - constructors/request.js, line 624

set a new header

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string |
`value` | string |

##### Returns:

Type
  RequestModule

#### headers() → {string}

Source:
  - constructors/request.js, line 615

##### Returns:

Type
  string

#### method() → {RequestModule.RequestConfig.method}

Source:
  - constructors/request.js, line 524
See:
  - module:request.RequestModule.RequestConfig

##### Returns:

Type
  RequestModule.RequestConfig.method

#### method(status) → {RequestModule}

Source:
  - constructors/request.js, line 530

##### Parameters:

Name | Type | Description
--- | --- | ---
`status` | string | XMLHttpRequest method name, default is `"GET"`

##### Returns:

Type
  RequestModule

#### open(methodopt, urlopt, asyncopt, timeoutopt) → {RequestModule}

Source:
  - constructors/request.js, line 563

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`method` | string | <optional> | `"GET"` |
`url` | string | <optional> |  |
`async` | boolean | <optional> |  |
`timeout` | number | <optional> |  | request timeout in seconds

##### Returns:

Type
  RequestModule

#### readyState() → {RequestModule.readyStateType}

Source:
  - constructors/request.js, line 472

##### Returns:

Type
  RequestModule.readyStateType

#### request() → {XMLHttpRequest}

Source:
  - constructors/request.js, line 176

##### Returns:

Type
  XMLHttpRequest

#### response(type, paramsopt) → {Promise.<Blob>}

Source:
  - constructors/request.js, line 197

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`type` | 'blob' |  |  |
`params` | Object | <optional> | `{type: 'application/octet-stream'}` | Blob constructor's params

##### Returns:

Type
  Promise.<Blob>

#### response(type) → {Promise.<string>}

Source:
  - constructors/request.js, line 212

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | 'text' | 'json' |

##### Returns:

Type
  Promise.<string>

#### response(type) → {HTMLElement}

Source:
  - constructors/request.js, line 219

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | 'document' |

##### Returns:

Type
  HTMLElement

#### response(type) → {Promise.<RequestModule>}

Source:
  - constructors/request.js, line 190

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | 'request' |

##### Returns:

Type
  Promise.<RequestModule>

#### response(type) → {Promise.<ArrayBuffer>}

Source:
  - constructors/request.js, line 205

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | 'arraybuffer' |

##### Returns:

Type
  Promise.<ArrayBuffer>

#### response() → {XMLHttpRequest.response}

Source:
  - constructors/request.js, line 183

##### Returns:

Type
  XMLHttpRequest.response

#### send(dataopt, typeopt) → {RequestModule}

Source:
  - constructors/request.js, line 583

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`data` | string | FormData | MediaStream | <optional> | `''` |
`type` | "asFormData" | "json" | <optional> | `null` |

##### Returns:

Type
  RequestModule

#### status() → {XMLHttpRequest.status}

Source:
  - constructors/request.js, line 485

##### Returns:

Type
  XMLHttpRequest.status

#### statusText() → {XMLHttpRequest.statusText}

Source:
  - constructors/request.js, line 494

##### Returns:

Type
  XMLHttpRequest.statusText

#### timeout(seconds) → {RequestModule}

Source:
  - constructors/request.js, line 398

update XMLHttpRequest timeout in seconds

##### Parameters:

Name | Type | Description
--- | --- | ---
`seconds` | number | set 0 to unlimited

##### Returns:

Type
  RequestModule

#### timeout() → {number}

Source:
  - constructors/request.js, line 391

current XMLHttpRequest timeout in seconds

##### Returns:

Type
  number

#### url() → {RequestModule.RequestConfig.url}

Source:
  - constructors/request.js, line 544
See:
  - module:request.RequestModule.RequestConfig

##### Returns:

Type
  RequestModule.RequestConfig.url

#### url(url) → {RequestModule}

Source:
  - constructors/request.js, line 544

##### Parameters:

Name | Type | Description
--- | --- | ---
`url` | string | setup the url that should be processed

##### Returns:

Type
  RequestModule

#### withCredentials() → {boolean}

Source:
  - constructors/request.js, line 413

current XMLHttpRequest withCredentials status

##### Returns:

Type
  boolean

#### withCredentials(status) → {RequestModule}

Source:
  - constructors/request.js, line 420

update XMLHttpRequest withCredentials flag

##### Parameters:

Name | Type | Description
--- | --- | ---
`status` | boolean |

##### Returns:

Type
  RequestModule

### Type Definitions

#### readyStateType

Source:
  - constructors/request.js, line 62

##### Properties:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`READY_STATE_UNSENT` | number | <optional> | `0` |
`READY_STATE_OPENED` | number | <optional> | `1` |
`READY_STATE_HEADERS_RECEIVED` | number | <optional> | `2` |
`READY_STATE_LOADING` | number | <optional> | `3` |
`READY_STATE_DONE` | number | <optional> | `4` |

##### Type:

- object

#### RequestConfig

Source:
  - constructors/request.js, line 38

##### Properties:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`method` | boolean | <optional> | `"GET"` |
`url` | boolean | <optional> | `"#"` |
`async` | boolean | <optional> | `true` |
`opened` | boolean | <optional> | `false` |
`isSent` | boolean | <optional> | `false` |
`isLoaded` | boolean | <optional> | `false` |
`isUploaded` | boolean | <optional> | `false` |
`ignoreStatusCode` | boolean | <optional> | `false` |

##### Type:

- Object