HTTP Requests Chipset

This module provides an HTTP request chipset for ReasonChip. It enables asynchronous HTTP requests using httpx.AsyncClient and returns structured responses.

This chipset is a wrapper around httpx. You can find httpx documentation here: HTTPX Documentation

Features

  • Supports standard HTTP methods (GET, POST, PUT, DELETE, etc.).
  • Handles request timeouts, network errors, and various HTTP errors gracefully.
  • Returns structured response data with status, headers, and content.
  • Limits response content size to prevent excessive memory usage.

View source code here: GitHub

http.http_request

Executes an HTTP request asynchronously using httpx.AsyncClient and returns the response.

Request Parameters

FieldTypeDescription
methodtyping.Literal['GET', 'OPTIONS', 'HEAD', 'POST', 'PUT', 'DELETE', 'PATCH']HTTP method to use for the request (e.g., GET, POST, DELETE).
urlTarget URL for the request.
timeoutRequest timeout in seconds.
headerstyping.Dict[str, str]Optional HTTP headers to include in the request.
contenttyping.Optional[bytes]Optional request body content as bytes.

Response

FieldTypeDescription
statustyping.Literal['OK', 'TIMEOUT_ERROR', 'NETWORK_ERROR', 'PROTOCOL_ERROR', 'PROXY_ERROR', 'UNSUPPORTED_PROTOCOL_ERROR', 'DECODING_ERROR', 'TOO_MANY_REDIRECTS', 'HTTP_STATUS_ERROR', 'INVALID_URL', 'COOKIE_CONFLICT', 'STREAM_ERROR', 'ERROR']Status of the HTTP request execution.
status_codetyping.Optional[int]HTTP response status code (e.g., 200, 404).
headerstyping.Dict[str, str]Response headers received from the server.
contenttyping.Optional[bytes]Response body content as bytes.

http.post_json_object

Executes an HTTP request asynchronously using httpx.AsyncClient and returns the response. The request body is a JSON object.

Request Parameters

FieldTypeDescription
urlTarget URL for the request.
timeoutRequest timeout in seconds.
headerstyping.Dict[str, str]Optional HTTP headers to include in the request.
contenttyping.Optional[typing.Dict[str, typing.Any]]Optional request body content as bytes.

Response

FieldTypeDescription
statustyping.Literal['OK', 'TIMEOUT_ERROR', 'NETWORK_ERROR', 'PROTOCOL_ERROR', 'PROXY_ERROR', 'UNSUPPORTED_PROTOCOL_ERROR', 'DECODING_ERROR', 'TOO_MANY_REDIRECTS', 'HTTP_STATUS_ERROR', 'INVALID_URL', 'COOKIE_CONFLICT', 'STREAM_ERROR', 'ERROR']Status of the HTTP request execution.
status_codetyping.Optional[int]HTTP response status code (e.g., 200, 404).
headerstyping.Dict[str, str]Response headers received from the server.
contenttyping.Optional[bytes]Response body content as bytes.

© 2025 South Patron LLC. All rights reserved.

AI everywhere.