Curl Interface

Types

EasyCurl.CurlResponseType
CurlResponse

Common response interface for all supported protocols.

Interface accessors

  • curl_total_time(x): Total time spent receiving a response in seconds.
  • curl_body(x): The response body.
source
EasyCurl.CurlClientType
CurlClient

Represents a client for making HTTP requests using libcurl. Allows for connection reuse.

Fields

  • curl_handle::Ptr{Cvoid}: The libcurl easy handle.
source

Methods

Base.closeFunction
close(client::CurlClient)

Closes the client instance by cleaning up the associated libcurl easy handle.

source
EasyCurl.curl_openFunction
curl_open(f::Function, x...; kw...)

A helper function for executing a batch of curl requests, using the same client. Optionally configure the client (see CurlClient for more details).

Examples

julia> curl_open() do client
           response = http_request(client, "GET", "http://httpbin.org/get")
           http_status(response)
       end
200
source

Utilities

EasyCurl.curl_joinurlFunction
curl_joinurl(basepart::String, parts::String...) -> String

Construct a URL by concatenating a basepart with one or more path parts. This function ensures that each segment is separated by a single forward slash (/), regardless of whether the basepart or parts already contain slashes at their boundaries.

Examples

julia> curl_joinurl("http://example.com", "path")
"http://example.com/path"

julia> curl_joinurl("http://example.com/", "/path/to/resource")
"http://example.com/path/to/resource"
source