httpclient

A module for making HTTP requests in Gingee applications. Provides get, post, put, patch, and delete. Body-bearing methods (post/put/patch) support JSON, form-urlencoded, plain text, XML, and multipart via options.postType. Text and binary responses are handled from the content-type header. Timeouts: If options.timeout is omitted, the platform default from gingee.jsonlimits.outbound_timeout_ms is applied (clamped to the remaining request budget when available). Concurrent outbound calls are also capped. Egress / SSRF: URLs are checked against gingee.jsonegress (default mode protected blocks private/loopback/link-local/metadata). Denied calls return status 403 with code: 'EGRESS_DENIED'. When DNS validation yields addresses, connect uses a pinned lookup so resolution cannot rebind between check and TCP connect. IMPORTANT: Requires explicit permission to use the module. See docs/permissions-guide for more details.
Description:
  • A module for making HTTP requests in Gingee applications. Provides get, post, put, patch, and delete. Body-bearing methods (post/put/patch) support JSON, form-urlencoded, plain text, XML, and multipart via options.postType. Text and binary responses are handled from the content-type header. Timeouts: If options.timeout is omitted, the platform default from gingee.jsonlimits.outbound_timeout_ms is applied (clamped to the remaining request budget when available). Concurrent outbound calls are also capped. Egress / SSRF: URLs are checked against gingee.jsonegress (default mode protected blocks private/loopback/link-local/metadata). Denied calls return status 403 with code: 'EGRESS_DENIED'. When DNS validation yields addresses, connect uses a pinned lookup so resolution cannot rebind between check and TCP connect. IMPORTANT: Requires explicit permission to use the module. See docs/permissions-guide for more details.

Members

(static, constant) FORM

Description:
  • Constant for form-urlencoded content type in POST requests. This constant can be used to specify that the POST request body is in form-urlencoded format.
Constant for form-urlencoded content type in POST requests. This constant can be used to specify that the POST request body is in form-urlencoded format.

(static, constant) JSON

Description:
  • Constant for JSON content type in POST requests. This constant can be used to specify that the POST request body is in JSON format.
Constant for JSON content type in POST requests. This constant can be used to specify that the POST request body is in JSON format.

(static, constant) MULTIPART

Description:
  • Constant for multipart/form-data content type in POST requests. This constant can be used to specify that the POST request body is in multipart/form-data format.
Constant for multipart/form-data content type in POST requests. This constant can be used to specify that the POST request body is in multipart/form-data format.

(static, constant) TEXT

Description:
  • Constant for plain text content type in POST requests. This constant can be used to specify that the POST request body is in plain text format.
Constant for plain text content type in POST requests. This constant can be used to specify that the POST request body is in plain text format.

(static, constant) XML

Description:
  • Constant for XML content type in POST requests. This constant can be used to specify that the POST request body is in XML format.
Constant for XML content type in POST requests. This constant can be used to specify that the POST request body is in XML format.

Methods

(static) delete(url, optionsopt) → {Promise.<{status: number, headers: object, body: (string|Buffer)}>}

Description:
  • Performs an HTTP DELETE request (no body).
Example
const response = await httpclient.delete('https://api.example.com/items/1');
Parameters:
Name Type Attributes Description
url string The URL to request.
options object <optional>
Axios request configuration options (e.g., headers, timeout, signal).
Returns:
Type
Promise.<{status: number, headers: object, body: (string|Buffer)}>

(static) get(url, optionsopt) → {Promise.<{status: number, headers: object, body: (string|Buffer)}>}

Description:
  • Performs an HTTP GET request.
Example
const response = await httpclient.get('https://api.example.com/data');
Parameters:
Name Type Attributes Description
url string The URL to request.
options object <optional>
Axios request configuration options (e.g., headers, timeout, signal).
Returns:
Type
Promise.<{status: number, headers: object, body: (string|Buffer)}>

(static) patch(url, body, optionsopt) → {Promise.<{status: number, headers: object, body: (string|Buffer)}>}

Description:
  • Performs an HTTP PATCH request (same body / postType options as post).
Example
const response = await httpclient.patch('https://api.example.com/items/1', { name: 'y' });
Parameters:
Name Type Attributes Description
url string The URL to patch.
body any The data to send in the request body.
options object <optional>
Axios request configuration options.
Properties
Name Type Attributes Default Description
postType string <optional>
httpclient.JSON Body content type.
Returns:
Type
Promise.<{status: number, headers: object, body: (string|Buffer)}>

(static) post(url, body, optionsopt) → {Promise.<{status: number, headers: object, body: (string|Buffer)}>}

Description:
  • Performs an HTTP POST request.
Example
const response = await httpclient.post('https://api.example.com/data', { key: 'value' });
Parameters:
Name Type Attributes Description
url string The URL to post to.
body any The data to send in the request body.
options object <optional>
Axios request configuration options.
Properties
Name Type Attributes Default Description
postType string <optional>
httpclient.JSON Body content type.
Returns:
Type
Promise.<{status: number, headers: object, body: (string|Buffer)}>

(static) put(url, body, optionsopt) → {Promise.<{status: number, headers: object, body: (string|Buffer)}>}

Description:
  • Performs an HTTP PUT request (same body / postType options as post).
Example
const response = await httpclient.put('https://api.example.com/items/1', { name: 'x' });
Parameters:
Name Type Attributes Description
url string The URL to put to.
body any The data to send in the request body.
options object <optional>
Axios request configuration options.
Properties
Name Type Attributes Default Description
postType string <optional>
httpclient.JSON Body content type.
Returns:
Type
Promise.<{status: number, headers: object, body: (string|Buffer)}>