---
product: Chilkat
product_version: 11.7.0
language: nodejs
language_label: Node.js
class: HttpResponse
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/nodejsHttpResponseRef.html
---
# Chilkat HttpResponse — Node.js — v11.7.0

> Chilkat 11.7.0 · language=nodejs · class=HttpResponse
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/HttpResponse.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/nodejs/guide.md`.

## Purpose

**Inspect HTTP status, headers, cookies, redirects, and response bodies.**

`Chilkat.HttpResponse` represents an HTTP response returned by certain `Chilkat.Http` methods. It provides access to the response status line, status code, headers, cookies, charset, content length, body bytes, body text, full MIME response, redirect URL, and helper methods for saving or loading the response body into Chilkat objects such as `BinData`, `StringBuilder`, `JsonObject`, `JsonArray`, and `Xml`.

**Status and reason**

Read the HTTP status code, status line, and related response information to determine whether the request succeeded, redirected, or failed.

**Headers and cookies**

Inspect response headers, retrieve individual header values, and access cookies returned by the server.

**Body as text or bytes**

Get the response body as raw bytes or decoded text, using the response charset information when appropriate.

**Structured body loading**

Load the body directly into `JsonObject`, `JsonArray`, `Xml`, `BinData`, or `StringBuilder` objects for further processing.

**Redirect information**

Access redirect-related information such as the redirect URL when the server responds with a redirect status.

**Save and inspect responses**

Save body content, inspect the full MIME-style response, and use response metadata for diagnostics, logging, or API troubleshooting.

**Common pattern:** Send a request with `Chilkat.Http`, check the `StatusCode`, inspect headers or cookies as needed, then retrieve the body in the form best suited to the response content: text, bytes, `BinData`, `StringBuilder`, JSON, or XML. Use `HttpResponse` for response inspection; use `Chilkat.Http` for the actual network request.

For an extended overview, see [HttpResponse Class Overview](https://www.chilkatsoft.com/httpresponse_class_overview.asp).

## Object creation, unlocking and error handling

**Object Creation**

```javascript
var obj = new chilkat.HttpResponse();
```

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in Node.js.

How failure is reported depends on the method's return type and is stated in the note under each method below. In every case the diagnostic text is in the `LastErrorText` property of the object whose method was called.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `DebugLogFilePath` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastErrorHtml` | `LastErrorHtml` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `LastErrorText` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `LastErrorXml` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `LastMethodSuccess` | read/write | Indicates the success or failure of the most recent method call: `true` means success, `false` means failure. |
| `VerboseLogging` | `VerboseLogging` | read/write | If set to `true`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `Version` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `Body` | property, read-only | `Body` |
| `BodyQP` | property, read-only | `BodyQP` |
| `BodyStr` | property, read-only | `BodyStr` |
| `Charset` | property, read-only | `Charset` |
| `ContentLength` | property, read-only | `ContentLength` |
| `DateStr` | property, read-only | `DateStr` |
| `Domain` | property, read-only | `Domain` |
| `FinalRedirectUrl` | property, read-only | `FinalRedirectUrl` |
| `FullMime` | property, read-only | `FullMime` |
| `Header` | property, read-only | `Header` |
| `NumCookies` | property, read-only | `NumCookies` |
| `NumHeaderFields` | property, read-only | `NumHeaderFields` |
| `StatusCode` | property, read-only | `StatusCode` |
| `StatusLine` | property, read-only | `StatusLine` |
| `StatusText` | property, read-only | `StatusText` |
| `UncommonOptions` | property, read/write | `UncommonOptions` |
| `GetBodyBd` | method | `var status = GetBodyBd(binData);` |
| `GetBodyJarr` | method | `var status = GetBodyJarr(jarr);` |
| `GetBodyJson` | method | `var status = GetBodyJson(json);` |
| `GetBodySb` | method | `var status = GetBodySb(sb);` |
| `GetBodyXml` | method | `var status = GetBodyXml(xml);` |
| `GetCookieDomain` | method | `var retStr = GetCookieDomain(index);` |
| `GetCookieExpiresStr` | method | `var retStr = GetCookieExpiresStr(index);` |
| `GetCookieName` | method | `var retStr = GetCookieName(index);` |
| `GetCookiePath` | method | `var retStr = GetCookiePath(index);` |
| `GetCookieValue` | method | `var retStr = GetCookieValue(index);` |
| `GetHeaderField` | method | `var retStr = GetHeaderField(fieldName);` |
| `GetHeaderFieldAttr` | method | `var retStr = GetHeaderFieldAttr(fieldName, attrName);` |
| `GetHeaderName` | method | `var retStr = GetHeaderName(index);` |
| `GetHeaderValue` | method | `var retStr = GetHeaderValue(index);` |
| `LoadTaskResult` | method | `var status = LoadTaskResult(task);` |
| `SaveBodyBinary` | method | `var status = SaveBodyBinary(path);` |
| `SaveBodyText` | method | `var status = SaveBodyText(bCrlf, path);` |
| `UrlEncParamValue` | method | `var retStr = UrlEncParamValue(encodedParamString, paramName);` |

## Properties

### HttpResponse.Body

`Chilkat 11.7.0 · nodejs · HttpResponse · Body · property · read-only`

```javascript
Body
```

· Buffer, read-only

The response body returned as a byte array.

### HttpResponse.BodyQP

`Chilkat 11.7.0 · nodejs · HttpResponse · BodyQP · property · read-only`

```javascript
BodyQP
```

· string, read-only

The same as the Body property, but returned as a quoted-printable encoded string.

### HttpResponse.BodyStr

`Chilkat 11.7.0 · nodejs · HttpResponse · BodyStr · property · read-only`

```javascript
BodyStr
```

· string, read-only

The response body returned as a string.

### HttpResponse.Charset

`Chilkat 11.7.0 · nodejs · HttpResponse · Charset · property · read-only`

```javascript
Charset
```

· string, read-only

The response charset, such as `iso-8859-1`, if applicable. Obviously, responses for GIF and JPG files will not have a charset.

### HttpResponse.ContentLength

`Chilkat 11.7.0 · nodejs · HttpResponse · ContentLength · property · read-only`

```javascript
ContentLength
```

· integer, read-only

The content length of the response, in bytes.

### HttpResponse.DateStr

`Chilkat 11.7.0 · nodejs · HttpResponse · DateStr · property · read-only`

```javascript
DateStr
```

· string, read-only

Returns the content of the Date response header field in RFC822 date/time string format.

### HttpResponse.Domain

`Chilkat 11.7.0 · nodejs · HttpResponse · Domain · property · read-only`

```javascript
Domain
```

· string, read-only

The domain of the HTTP server that created this response.

### HttpResponse.FinalRedirectUrl

`Chilkat 11.7.0 · nodejs · HttpResponse · FinalRedirectUrl · property · read-only · since 9.5.0.49`

```javascript
FinalRedirectUrl
```

· string, read-only

Returns the redirect URL for 301/302 responses.

### HttpResponse.FullMime

`Chilkat 11.7.0 · nodejs · HttpResponse · FullMime · property · read-only`

```javascript
FullMime
```

· string, read-only

Returns the full MIME (header + body) of the HTTP response.

### HttpResponse.Header

`Chilkat 11.7.0 · nodejs · HttpResponse · Header · property · read-only`

```javascript
Header
```

· string, read-only

The full text of the response header.

### HttpResponse.NumCookies

`Chilkat 11.7.0 · nodejs · HttpResponse · NumCookies · property · read-only`

```javascript
NumCookies
```

· integer, read-only

The number of cookies included in the response.

### HttpResponse.NumHeaderFields

`Chilkat 11.7.0 · nodejs · HttpResponse · NumHeaderFields · property · read-only`

```javascript
NumHeaderFields
```

· integer, read-only

The number of response header fields.

### HttpResponse.StatusCode

`Chilkat 11.7.0 · nodejs · HttpResponse · StatusCode · property · read-only`

```javascript
StatusCode
```

· integer, read-only

The status code (as an integer) from the first line of an HTTP response. If the StatusLine = `HTTP/1.0 200 OK`, the response status code returned is 200.

### HttpResponse.StatusLine

`Chilkat 11.7.0 · nodejs · HttpResponse · StatusLine · property · read-only`

```javascript
StatusLine
```

· string, read-only

The first line of an HTTP response, such as `HTTP/1.0 200 OK`.

### HttpResponse.StatusText

`Chilkat 11.7.0 · nodejs · HttpResponse · StatusText · property · read-only · since 9.5.0.49`

```javascript
StatusText
```

· string, read-only

The text that follows the status code in the 1st line of the HTTP response. For example, i the first line of an HTTP response is `HTTP/1.0 200 OK`, then this property contains `OK`.

### HttpResponse.UncommonOptions

`Chilkat 11.7.0 · nodejs · HttpResponse · UncommonOptions · property · read/write · since 9.5.0.89`

```javascript
UncommonOptions
```

· string

This is a catch-all property to be used for uncommon needs. Can be set to a list of the following comma separated keywords:

- `TakeResponseBody` - Introduced in v9.5.0.89. The GetBody\* methods will transfer the body to the target object instead of copying the contents. This can be useful if the response body is extremely large because it will reduce the overall memory requirement.

## Methods

### HttpResponse.GetBodyBd

`Chilkat 11.7.0 · nodejs · HttpResponse · GetBodyBd · method · since 9.5.0.64`

```javascript
var status = GetBodyBd(binData);
```

· Returns Boolean (true for success, false for failure).  
· binData BinData

Copies the response body to a BinData object.

Returns true for success, false for failure.

### HttpResponse.GetBodyJarr

`Chilkat 11.7.0 · nodejs · HttpResponse · GetBodyJarr · method · since 9.5.0.89`

```javascript
var status = GetBodyJarr(jarr);
```

· Returns Boolean (true for success, false for failure).  
· jarr JsonArray

Loads the JSON array response body into a JsonArray This method should only be called when it is known that the response body contains a JSON array (beginning with a square bracket '\[' and ending with a square bracket '\]')

Returns true for success, false for failure.

### HttpResponse.GetBodyJson

`Chilkat 11.7.0 · nodejs · HttpResponse · GetBodyJson · method · since 9.5.0.89`

```javascript
var status = GetBodyJson(json);
```

· Returns Boolean (true for success, false for failure).  
· json JsonObject

Loads the JSON response body into a JsonObject. This method should only be called when it is known that the response body contains JSON (beginning with a curly brace '{' and ending with a curly brace '}')

Returns true for success, false for failure.

### HttpResponse.GetBodySb

`Chilkat 11.7.0 · nodejs · HttpResponse · GetBodySb · method · since 9.5.0.64`

```javascript
var status = GetBodySb(sb);
```

· Returns Boolean (true for success, false for failure).  
· sb StringBuilder

Copies the response body to a Chilkat StringBuilder object.

Returns true for success, false for failure.

### HttpResponse.GetBodyXml

`Chilkat 11.7.0 · nodejs · HttpResponse · GetBodyXml · method · since 9.5.0.89`

```javascript
var status = GetBodyXml(xml);
```

· Returns Boolean (true for success, false for failure).  
· xml Xml

Loads the XML response body into an XML object. This method should only be called when it is known that the response body contains XML.

Returns true for success, false for failure.

### HttpResponse.GetCookieDomain

`Chilkat 11.7.0 · nodejs · HttpResponse · GetCookieDomain · method`

```javascript
var retStr = GetCookieDomain(index);
```

· Returns a String.  
· index Number

Returns the domain of the Nth cookie in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.

Returns `null` on failure

### HttpResponse.GetCookieExpiresStr

`Chilkat 11.7.0 · nodejs · HttpResponse · GetCookieExpiresStr · method`

```javascript
var retStr = GetCookieExpiresStr(index);
```

· Returns a String.  
· index Number

Returns the expiration date/time of the Nth cookie in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.

Returns `null` on failure

### HttpResponse.GetCookieName

`Chilkat 11.7.0 · nodejs · HttpResponse · GetCookieName · method`

```javascript
var retStr = GetCookieName(index);
```

· Returns a String.  
· index Number

Returns the name of the Nth cookie returned in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.

Returns `null` on failure

### HttpResponse.GetCookiePath

`Chilkat 11.7.0 · nodejs · HttpResponse · GetCookiePath · method`

```javascript
var retStr = GetCookiePath(index);
```

· Returns a String.  
· index Number

Returns the path of the Nth cookie returned in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.

Returns `null` on failure

### HttpResponse.GetCookieValue

`Chilkat 11.7.0 · nodejs · HttpResponse · GetCookieValue · method`

```javascript
var retStr = GetCookieValue(index);
```

· Returns a String.  
· index Number

Returns the value of the Nth cookie returned in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.

Returns `null` on failure

### HttpResponse.GetHeaderField

`Chilkat 11.7.0 · nodejs · HttpResponse · GetHeaderField · method`

```javascript
var retStr = GetHeaderField(fieldName);
```

· Returns a String.  
· fieldName String

Returns the value of a response header field accessed by field name.

Returns `null` on failure

### HttpResponse.GetHeaderFieldAttr

`Chilkat 11.7.0 · nodejs · HttpResponse · GetHeaderFieldAttr · method`

```javascript
var retStr = GetHeaderFieldAttr(fieldName, attrName);
```

· Returns a String.  
· fieldName String  
· attrName String

Returns a response header field attribute. As an example, the response charset is simply the GetHeaderFieldAttr(`content-type`,`charset`)

Returns `null` on failure

### HttpResponse.GetHeaderName

`Chilkat 11.7.0 · nodejs · HttpResponse · GetHeaderName · method`

```javascript
var retStr = GetHeaderName(index);
```

· Returns a String.  
· index Number

Gets the name of the Nth response header field. Indexing begins at 0. The number of response headers is specified by the NumHeaderFields property.

Returns `null` on failure

### HttpResponse.GetHeaderValue

`Chilkat 11.7.0 · nodejs · HttpResponse · GetHeaderValue · method`

```javascript
var retStr = GetHeaderValue(index);
```

· Returns a String.  
· index Number

Gets the value of the Nth response header field. Indexing begins at 0. The number of response headers is specified by the NumHeaderFields property.

Returns `null` on failure

### HttpResponse.LoadTaskResult

`Chilkat 11.7.0 · nodejs · HttpResponse · LoadTaskResult · method · since 9.5.0.52`

```javascript
var status = LoadTaskResult(task);
```

· Returns Boolean (true for success, false for failure).  
· task Task

Loads the HTTP response from a completed asynchronous task. A failed return value indicates that no HTTP response was received in the HTTP asynchronous method call (i.e. the asynchronous HTTP request failed in such a way that no response was received).

Returns true for success, false for failure.

### HttpResponse.SaveBodyBinary

`Chilkat 11.7.0 · nodejs · HttpResponse · SaveBodyBinary · method`

```javascript
var status = SaveBodyBinary(path);
```

· Returns Boolean (true for success, false for failure).  
· path String

Saves the body of the HTTP response to a file.

Returns true for success, false for failure.

### HttpResponse.SaveBodyText

`Chilkat 11.7.0 · nodejs · HttpResponse · SaveBodyText · method`

```javascript
var status = SaveBodyText(bCrlf, path);
```

· Returns Boolean (true for success, false for failure).  
· bCrlf Boolean  
· path String

Saves the HTTP response body to a file. This method provides control over CRLF vs bare-LF line-endings. If `bCrlf` is `true`, then line endings are automatically converted to CRLF if necessary. If `bCrlf` is `false`, then line-endings are automatically converted to bare-LF's (Unix style) if necessary.

To save the HTTP response body exactly as-is (with no line-ending manipulation), then call SaveBodyBinary.

Returns true for success, false for failure.

### HttpResponse.UrlEncParamValue

`Chilkat 11.7.0 · nodejs · HttpResponse · UrlEncParamValue · method`

```javascript
var retStr = UrlEncParamValue(encodedParamString, paramName);
```

· Returns a String.  
· encodedParamString String  
· paramName String

Convenience method for parsing a param's value out of a URL-encoded param string. For example, if a caller passes the following string in `encodedParamString`:

```
oauth_token=ABC&oauth_token_secret=123&oauth_callback_confirmed=true
```

and `oauth_token_secret` in `paramName`, then the return value would be `123`.

Returns `null` on failure

## Related classes

[`BinData`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/nodejs/classes/BinData.md), [`JsonArray`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/nodejs/classes/JsonArray.md), [`JsonObject`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/nodejs/classes/JsonObject.md), [`StringBuilder`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/nodejs/classes/StringBuilder.md), [`Task`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/nodejs/classes/Task.md), [`Xml`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/nodejs/classes/Xml.md)

