---
product: Chilkat
product_version: 11.7.0
language: b4x
language_label: B4X
class: HttpResponse
class_name: ChilkatHttpResponse
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/b4x_HttpResponseRef.html
---
# Chilkat HttpResponse — B4X — v11.7.0

> Chilkat 11.7.0 · language=b4x · class=HttpResponse (ChilkatHttpResponse)
> 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/b4x/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

**Declare / Initialize / Dispose**

```visual-basic
Sub Process_Globals
    Private obj As ChilkatHttpResponse
End Sub

' Call Initialize before first use -- typically in AppStart (B4J)
' or Activity_Create (B4A):
obj.Initialize                ' classes without events
obj.Initialize("evt")        ' classes with events: "evt" becomes the
                              ' prefix of event Subs such as evt_PercentDone
```

`Initialize / Initialize (EventName As String)`

Creates the underlying native Chilkat object. Classes that support events take an `EventName` argument: it becomes the prefix of the event Subs (`<EventName>_AbortCheck`, `<EventName>_PercentDone`, `<EventName>_ProgressInfo`); classes without events take no arguments. The native Chilkat library loads automatically on the first Initialize — from the APK on Android, or extracted from ChilkatB4J.jar on Windows/Linux/macOS.

`IsInitialized As Boolean`

`True` if `Initialize` has been called and the native object exists.

`Dispose`

Explicitly frees the underlying native object. Calling `Dispose` is optional — every ChilkatHttpResponse is also freed automatically when garbage-collected — but is recommended for long-lived objects holding sockets, sessions, or large buffers. A disposed object can be re-Initialized.

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 B4X.

## 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` | `' read/write DebugLogFilePath As String` | 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` | `' read-only LastErrorHtml As String` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `' read-only LastErrorText As String` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `' read-only LastErrorXml As String` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `' read/write LastMethodSuccess As Boolean` | read/write | Indicates the success or failure of the most recent method call: `True` means success, `False` means failure. |
| `VerboseLogging` | `' read/write VerboseLogging As Boolean` | read/write | If set to `True`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `' read-only Version As String` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `BodyQP` | property, read-only | `' read-only BodyQP As String` |
| `BodyStr` | property, read-only | `' read-only BodyStr As String` |
| `Charset` | property, read-only | `' read-only Charset As String` |
| `ContentLength` | property, read-only | `' read-only ContentLength As Long` |
| `ContentLength64` | property, read-only | `' read-only ContentLength64 As Long` |
| `DateStr` | property, read-only | `' read-only DateStr As String` |
| `Domain` | property, read-only | `' read-only Domain As String` |
| `FinalRedirectUrl` | property, read-only | `' read-only FinalRedirectUrl As String` |
| `FullMime` | property, read-only | `' read-only FullMime As String` |
| `Header` | property, read-only | `' read-only Header As String` |
| `NumCookies` | property, read-only | `' read-only NumCookies As Int` |
| `NumHeaderFields` | property, read-only | `' read-only NumHeaderFields As Int` |
| `StatusCode` | property, read-only | `' read-only StatusCode As Int` |
| `StatusLine` | property, read-only | `' read-only StatusLine As String` |
| `StatusText` | property, read-only | `' read-only StatusText As String` |
| `UncommonOptions` | property, read/write | `' read/write UncommonOptions As String` |
| `GetBodyBd` | method | `GetBodyBd (binData As ChilkatBinData) As Boolean` |
| `GetBodyJarr` | method | `GetBodyJarr (jarr As ChilkatJsonArray) As Boolean` |
| `GetBodyJson` | method | `GetBodyJson (json As ChilkatJsonObject) As Boolean` |
| `GetBodySb` | method | `GetBodySb (sb As ChilkatStringBuilder) As Boolean` |
| `GetBodyXml` | method | `GetBodyXml (xml As ChilkatXml) As Boolean` |
| `GetCookieDomain` | method | `GetCookieDomain (index As Int) As String` |
| `GetCookieExpiresStr` | method | `GetCookieExpiresStr (index As Int) As String` |
| `GetCookieName` | method | `GetCookieName (index As Int) As String` |
| `GetCookiePath` | method | `GetCookiePath (index As Int) As String` |
| `GetCookieValue` | method | `GetCookieValue (index As Int) As String` |
| `GetHeaderField` | method | `GetHeaderField (fieldName As String) As String` |
| `GetHeaderFieldAttr` | method | `GetHeaderFieldAttr (fieldName As String, attrName As String) As String` |
| `GetHeaderName` | method | `GetHeaderName (index As Int) As String` |
| `GetHeaderValue` | method | `GetHeaderValue (index As Int) As String` |
| `SaveBodyBinary` | method | `SaveBodyBinary (path As String) As Boolean` |
| `SaveBodyText` | method | `SaveBodyText (bCrlf As Boolean, path As String) As Boolean` |
| `UrlEncParamValue` | method | `UrlEncParamValue (encodedParamString As String, paramName As String) As String` |

## Properties

### HttpResponse.BodyQP

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

```visual-basic
' read-only

BodyQP As String
```

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

### HttpResponse.BodyStr

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

```visual-basic
' read-only

BodyStr As String
```

The response body returned as a string.

### HttpResponse.Charset

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

```visual-basic
' read-only

Charset As String
```

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 · b4x · HttpResponse · ContentLength · property · read-only`

```visual-basic
' read-only

ContentLength As Long
```

The content length of the response, in bytes.

### HttpResponse.ContentLength64

`Chilkat 11.7.0 · b4x · HttpResponse · ContentLength64 · property · read-only`

```visual-basic
' read-only

ContentLength64 As Long
```

The content length of the response, in number of bytes, returned as a 64-bit integer.

### HttpResponse.DateStr

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

```visual-basic
' read-only

DateStr As String
```

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

### HttpResponse.Domain

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

```visual-basic
' read-only

Domain As String
```

The domain of the HTTP server that created this response.

### HttpResponse.FinalRedirectUrl

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

```visual-basic
' read-only

FinalRedirectUrl As String
```

Returns the redirect URL for 301/302 responses.

### HttpResponse.FullMime

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

```visual-basic
' read-only

FullMime As String
```

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

### HttpResponse.Header

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

```visual-basic
' read-only

Header As String
```

The full text of the response header.

### HttpResponse.NumCookies

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

```visual-basic
' read-only

NumCookies As Int
```

The number of cookies included in the response.

### HttpResponse.NumHeaderFields

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

```visual-basic
' read-only

NumHeaderFields As Int
```

The number of response header fields.

### HttpResponse.StatusCode

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

```visual-basic
' read-only

StatusCode As Int
```

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 · b4x · HttpResponse · StatusLine · property · read-only`

```visual-basic
' read-only

StatusLine As String
```

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

### HttpResponse.StatusText

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

```visual-basic
' read-only

StatusText As String
```

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 · b4x · HttpResponse · UncommonOptions · property · read/write · since 9.5.0.89`

```visual-basic
' read/write

UncommonOptions As 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 · b4x · HttpResponse · GetBodyBd · method · since 9.5.0.64`

```visual-basic
GetBodyBd (binData As ChilkatBinData) As Boolean
```

Copies the response body to a BinData object.

Returns True for success, False for failure.

### HttpResponse.GetBodyJarr

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

```visual-basic
GetBodyJarr (jarr As ChilkatJsonArray) As Boolean
```

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 · b4x · HttpResponse · GetBodyJson · method · since 9.5.0.89`

```visual-basic
GetBodyJson (json As ChilkatJsonObject) As Boolean
```

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 · b4x · HttpResponse · GetBodySb · method · since 9.5.0.64`

```visual-basic
GetBodySb (sb As ChilkatStringBuilder) As Boolean
```

Copies the response body to a Chilkat StringBuilder object.

Returns True for success, False for failure.

### HttpResponse.GetBodyXml

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

```visual-basic
GetBodyXml (xml As ChilkatXml) As Boolean
```

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 · b4x · HttpResponse · GetCookieDomain · method`

```visual-basic
GetCookieDomain (index As Int) As String
```

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 · b4x · HttpResponse · GetCookieExpiresStr · method`

```visual-basic
GetCookieExpiresStr (index As Int) As String
```

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 · b4x · HttpResponse · GetCookieName · method`

```visual-basic
GetCookieName (index As Int) As String
```

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 · b4x · HttpResponse · GetCookiePath · method`

```visual-basic
GetCookiePath (index As Int) As String
```

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 · b4x · HttpResponse · GetCookieValue · method`

```visual-basic
GetCookieValue (index As Int) As String
```

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 · b4x · HttpResponse · GetHeaderField · method`

```visual-basic
GetHeaderField (fieldName As String) As String
```

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

Returns `Null` on failure

### HttpResponse.GetHeaderFieldAttr

`Chilkat 11.7.0 · b4x · HttpResponse · GetHeaderFieldAttr · method`

```visual-basic
GetHeaderFieldAttr (fieldName As String, attrName As String) As 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 · b4x · HttpResponse · GetHeaderName · method`

```visual-basic
GetHeaderName (index As Int) As String
```

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 · b4x · HttpResponse · GetHeaderValue · method`

```visual-basic
GetHeaderValue (index As Int) As String
```

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.SaveBodyBinary

`Chilkat 11.7.0 · b4x · HttpResponse · SaveBodyBinary · method`

```visual-basic
SaveBodyBinary (path As String) As Boolean
```

Saves the body of the HTTP response to a file.

Returns True for success, False for failure.

### HttpResponse.SaveBodyText

`Chilkat 11.7.0 · b4x · HttpResponse · SaveBodyText · method`

```visual-basic
SaveBodyText (bCrlf As Boolean, path As String) As Boolean
```

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 · b4x · HttpResponse · UrlEncParamValue · method`

```visual-basic
UrlEncParamValue (encodedParamString As String, paramName As String) As 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/b4x/classes/BinData.md), [`JsonArray`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/b4x/classes/JsonArray.md), [`JsonObject`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/b4x/classes/JsonObject.md), [`StringBuilder`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/b4x/classes/StringBuilder.md), [`Xml`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/b4x/classes/Xml.md)

