object

http_client

Request-oriented HTTP client facade built on top of the URL and HTTP transport libraries.

Availability:
logtalk_load(http_client(loader))
Author: Paulo Moura
Version: 1:0:0
Date: 2026-07-09
Compilation flags:
static, context_switching_calls
Remarks:
(none)

Public predicates

request/4

Builds a normalized request from the given method, absolute URL, and options, selects a compatible transport, performs a one-shot exchange, and returns the response.

Compilation flags:
static
Template:
request(Method,URL,Response,Options)
Mode and number of proofs:
request(+atom,+atom,--compound,+list) - one_or_error
Exceptions:
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options is a variable or a partial list:
instantiation_error
Options is neither a variable nor a list:
type_error(list,Options)
An element Option of the list Options is neither a variable nor a compound term:
type_error(compound,Option)
An element Option of the list Options is a compound term but not a valid option:
domain_error(option,Option)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
Options contains invalid form-data headers:
domain_error(http_client_form_data_headers,Headers)
Options contains invalid form-data properties:
domain_error(http_client_form_data_properties,Properties)
The generated request is not a valid normalized HTTP request term:
domain_error(http_request,Request)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

request/5

Builds a normalized request from the given method, absolute URL, and options, validates it against an open compatible connection or pool handle endpoint, selects a compatible transport, performs one exchange, and returns the response.

Compilation flags:
static
Template:
request(ConnectionOrPool,Method,URL,Response,Options)
Mode and number of proofs:
request(+compound,+atom,+atom,--compound,+list) - one_or_error
Exceptions:
ConnectionOrPool is a variable:
instantiation_error
ConnectionOrPool is not a valid reusable connection or pool handle:
domain_error(http_socket_transport_connection_or_pool,ConnectionOrPool)
ConnectionOrPool is not connected to the requested endpoint:
domain_error(http_client_connection_target,endpoint(EndpointHost,EndpointPort,Host,Port))
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options is a variable or a partial list:
instantiation_error
Options is neither a variable nor a list:
type_error(list,Options)
An element Option of the list Options is neither a variable nor a compound term:
type_error(compound,Option)
An element Option of the list Options is a compound term but not a valid option:
domain_error(option,Option)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
Options contains invalid form-data headers:
domain_error(http_client_form_data_headers,Headers)
Options contains invalid form-data properties:
domain_error(http_client_form_data_properties,Properties)
The generated request is not a valid normalized HTTP request term:
domain_error(http_request,Request)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

get/3

Convenience wrapper over request/4 using the get method.

Compilation flags:
static
Template:
get(URL,Response,Options)
Mode and number of proofs:
get(+atom,--compound,+list) - one_or_error
Exceptions:
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

get/4

Convenience wrapper over request/5 using the get method.

Compilation flags:
static
Template:
get(ConnectionOrPool,URL,Response,Options)
Mode and number of proofs:
get(+compound,+atom,--compound,+list) - one_or_error
Exceptions:
ConnectionOrPool is not a valid reusable connection or pool handle:
domain_error(http_socket_transport_connection_or_pool,ConnectionOrPool)
ConnectionOrPool is not connected to the requested endpoint:
domain_error(http_client_connection_target,endpoint(EndpointHost,EndpointPort,Host,Port))
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

head/3

Convenience wrapper over request/4 using the head method.

Compilation flags:
static
Template:
head(URL,Response,Options)
Mode and number of proofs:
head(+atom,--compound,+list) - one_or_error
Exceptions:
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

head/4

Convenience wrapper over request/5 using the head method.

Compilation flags:
static
Template:
head(ConnectionOrPool,URL,Response,Options)
Mode and number of proofs:
head(+compound,+atom,--compound,+list) - one_or_error
Exceptions:
ConnectionOrPool is not a valid reusable connection or pool handle:
domain_error(http_socket_transport_connection_or_pool,ConnectionOrPool)
ConnectionOrPool is not connected to the requested endpoint:
domain_error(http_client_connection_target,endpoint(EndpointHost,EndpointPort,Host,Port))
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

delete/3

Convenience wrapper over request/4 using the delete method.

Compilation flags:
static
Template:
delete(URL,Response,Options)
Mode and number of proofs:
delete(+atom,--compound,+list) - one_or_error
Exceptions:
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

delete/4

Convenience wrapper over request/5 using the delete method.

Compilation flags:
static
Template:
delete(ConnectionOrPool,URL,Response,Options)
Mode and number of proofs:
delete(+compound,+atom,--compound,+list) - one_or_error
Exceptions:
ConnectionOrPool is not a valid reusable connection or pool handle:
domain_error(http_socket_transport_connection_or_pool,ConnectionOrPool)
ConnectionOrPool is not connected to the requested endpoint:
domain_error(http_client_connection_target,endpoint(EndpointHost,EndpointPort,Host,Port))
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

post/4

Convenience wrapper over request/4 using the post method and the given request body.

Compilation flags:
static
Template:
post(URL,Body,Response,Options)
Mode and number of proofs:
post(+atom,+compound,--compound,+list) - one_or_error
Exceptions:
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
Body is invalid for the generated normalized HTTP request:
domain_error(http_body,Body)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

post/5

Convenience wrapper over request/5 using the post method and the given request body.

Compilation flags:
static
Template:
post(ConnectionOrPool,URL,Body,Response,Options)
Mode and number of proofs:
post(+compound,+atom,+compound,--compound,+list) - one_or_error
Exceptions:
ConnectionOrPool is not a valid reusable connection or pool handle:
domain_error(http_socket_transport_connection_or_pool,ConnectionOrPool)
ConnectionOrPool is not connected to the requested endpoint:
domain_error(http_client_connection_target,endpoint(EndpointHost,EndpointPort,Host,Port))
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
Body is invalid for the generated normalized HTTP request:
domain_error(http_body,Body)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

put/4

Convenience wrapper over request/4 using the put method and the given request body.

Compilation flags:
static
Template:
put(URL,Body,Response,Options)
Mode and number of proofs:
put(+atom,+compound,--compound,+list) - one_or_error
Exceptions:
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
Body is invalid for the generated normalized HTTP request:
domain_error(http_body,Body)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

put/5

Convenience wrapper over request/5 using the put method and the given request body.

Compilation flags:
static
Template:
put(ConnectionOrPool,URL,Body,Response,Options)
Mode and number of proofs:
put(+compound,+atom,+compound,--compound,+list) - one_or_error
Exceptions:
ConnectionOrPool is not a valid reusable connection or pool handle:
domain_error(http_socket_transport_connection_or_pool,ConnectionOrPool)
ConnectionOrPool is not connected to the requested endpoint:
domain_error(http_client_connection_target,endpoint(EndpointHost,EndpointPort,Host,Port))
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
Body is invalid for the generated normalized HTTP request:
domain_error(http_body,Body)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

patch/4

Convenience wrapper over request/4 using the patch method and the given request body.

Compilation flags:
static
Template:
patch(URL,Body,Response,Options)
Mode and number of proofs:
patch(+atom,+compound,--compound,+list) - one_or_error
Exceptions:
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
Body is invalid for the generated normalized HTTP request:
domain_error(http_body,Body)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

patch/5

Convenience wrapper over request/5 using the patch method and the given request body.

Compilation flags:
static
Template:
patch(ConnectionOrPool,URL,Body,Response,Options)
Mode and number of proofs:
patch(+compound,+atom,+compound,--compound,+list) - one_or_error
Exceptions:
ConnectionOrPool is not a valid reusable connection or pool handle:
domain_error(http_socket_transport_connection_or_pool,ConnectionOrPool)
ConnectionOrPool is not connected to the requested endpoint:
domain_error(http_client_connection_target,endpoint(EndpointHost,EndpointPort,Host,Port))
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
Body is invalid for the generated normalized HTTP request:
domain_error(http_body,Body)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

query/4

Convenience wrapper over request/4 using the query method and the given request body.

Compilation flags:
static
Template:
query(URL,Body,Response,Options)
Mode and number of proofs:
query(+atom,+compound,--compound,+list) - one_or_error
Exceptions:
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
Body is invalid for the generated normalized HTTP request:
domain_error(http_body,Body)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

query/5

Convenience wrapper over request/5 using the query method and the given request body.

Compilation flags:
static
Template:
query(ConnectionOrPool,URL,Body,Response,Options)
Mode and number of proofs:
query(+compound,+atom,+compound,--compound,+list) - one_or_error
Exceptions:
ConnectionOrPool is not a valid reusable connection or pool handle:
domain_error(http_socket_transport_connection_or_pool,ConnectionOrPool)
ConnectionOrPool is not connected to the requested endpoint:
domain_error(http_client_connection_target,endpoint(EndpointHost,EndpointPort,Host,Port))
URL is a variable:
instantiation_error
URL is not a supported absolute HTTP URL:
domain_error(http_client_url,URL)
URL uses an unsupported HTTP scheme:
domain_error(http_client_scheme,Scheme)
Options contains an invalid HTTP client request option:
domain_error(http_client_request_option,Option)
Body is invalid for the generated normalized HTTP request:
domain_error(http_body,Body)
The delegated socket exchange rejects the response stream:
domain_error(http_response_stream,Error)

open_websocket/4

Builds a WebSocket opening-handshake request from the given absolute WebSocket URL and options, selects a compatible transport, opens a reusable socket connection, validates the server 101 response, and returns both the connection handle and the response.

Compilation flags:
static
Template:
open_websocket(URL,Connection,Response,Options)
Mode and number of proofs:
open_websocket(+atom,--compound,--compound,+list) - one_or_error
Exceptions:
URL is a variable:
instantiation_error
URL is not a supported absolute WebSocket URL:
domain_error(http_client_websocket_url,URL)
URL uses an unsupported WebSocket scheme:
domain_error(http_client_websocket_scheme,Scheme)
Options is a variable or a partial list:
instantiation_error
Options is neither a variable nor a list:
type_error(list,Options)
An element Option of the list Options is neither a variable nor a compound term:
type_error(compound,Option)
An element Option of the list Options is a compound term but not a valid option:
domain_error(option,Option)
Options contains an invalid WebSocket client option:
domain_error(http_client_websocket_option,Option)
Options contains an invalid WebSocket HTTP version:
domain_error(http_client_websocket_version,Version)
Options contains reserved WebSocket headers:
domain_error(http_client_websocket_headers,Headers)
The WebSocket server rejects the version:
domain_error(http_client_websocket_version_rejection,Response)
The WebSocket server rejects authentication:
domain_error(http_client_websocket_authentication_rejection,Response)
The WebSocket server redirects the opening handshake:
domain_error(http_client_websocket_redirection_rejection,Response)
The WebSocket server rejects the opening handshake:
domain_error(http_client_websocket_rejection,Response)
The WebSocket server response is not a valid opening handshake response:
domain_error(http_client_websocket_response,Response)

Protected predicates

(no local declarations; see entity ancestors if any)

Private predicates

(no local declarations; see entity ancestors if any)

Operators

(none)