Bundle Shared networking types used across all HTTP libraries: Url (parsing and construction), Response (status code, headers, body), Cookie, and WebDownloader for streaming downloads. Compile with -lib net.
Response
HTTP response for methods such as GET, POST and PUT
Operations
GetCode #
Gets the response code
method : public : GetCode() ~ IntReturn
| Type | Description |
|---|---|
| Int | response code |
GetContent #
Gets response content
method : public : GetContent() ~ Byte[]Return
| Type | Description |
|---|---|
| Byte | response content |
Example
response := Web.HTTP.HttpsClient->QuickGet(Web.HTTP.Url->New("https://httpbin.org/get"));
if(response <> Nil) {
bytes := response->GetContent();
String->New(bytes)->PrintLine(); # raw response body
};GetType #
Gets content type
method : public : GetType() ~ StringReturn
| Type | Description |
|---|---|
| String | content type |
Example
url := Web.HTTP.Url->New("https://httpbin.org/get");
response := Web.HTTP.HttpsClient->QuickGet(url);
if(response <> Nil) {
response->GetType()->PrintLine(); # application/json
response->GetCode()->PrintLine(); # 200
};ToString #
Get the string representation
method : public : ToString() ~ StringReturn
| Type | Description |
|---|---|
| String | string representation |
Example
response := Web.HTTP.HttpsClient->QuickGet(Web.HTTP.Url->New("https://httpbin.org/get"));
if(response <> Nil) {
response->ToString()->PrintLine(); # code=200, type=application/json, content_length=...
};