gleam/httpc
Types
Configuration that can be used to send HTTP requests.
To be used with dispatch
and dispatch_bits
.
pub opaque type Configuration
Functions
pub fn configure() -> Configuration
Create a new configuration with the default settings.
pub fn dispatch(
config: Configuration,
request: Request(String),
) -> Result(Response(String), Dynamic)
Send a HTTP request of unicode data.
pub fn dispatch_bits(
config: Configuration,
req: Request(BitArray),
) -> Result(Response(BitArray), Dynamic)
Send a HTTP request of binary data.
pub fn send(
req: Request(String),
) -> Result(Response(String), Dynamic)
Send a HTTP request of unicode data using the default configuration.
If you wish to use some other configuration use dispatch
instead.
pub fn send_bits(
req: Request(BitArray),
) -> Result(Response(BitArray), Dynamic)
Send a HTTP request of binary data using the default configuration.
If you wish to use some other configuration use dispatch_bits
instead.
pub fn verify_tls(
config: Configuration,
which: Bool,
) -> Configuration
Set whether to verify the TLS certificate of the server.
This defaults to True
, meaning that the TLS certificate will be verified
unless you call this function with False
.
Setting this to False
can make your application vulnerable to
man-in-the-middle attacks and other security risks. Do not do this unless
you are sure and you understand the risks.