Curl Interface
Types
EasyCurl.CurlResponse
— TypeCurlResponse
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.
EasyCurl.CurlClient
— TypeCurlClient
Represents a client for making HTTP requests using libcurl. Allows for connection reuse.
Fields
curl_handle::Ptr{Cvoid}
: The libcurl easy handle.
Methods
Base.close
— Functionclose(client::CurlClient)
Closes the client
instance by cleaning up the associated libcurl easy handle.
EasyCurl.curl_open
— Functioncurl_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
Utilities
EasyCurl.curl_joinurl
— Functioncurl_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"