Curl Interface
Types
EasyCurl.CurlResponse — TypeCurlResponseCommon 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 — TypeCurlClientRepresents a client for making HTTP requests using libcurl. Allows for connection reuse.
Fields
easy_handle::Ptr{Cvoid}: The libcurl easy handle.multi_handle::Ptr{Cvoid}: The libcurl multi handle.
Methods
Base.close — Functionclose(client::CurlClient)Closes the client instance by cleaning up the associated libcurl easy handle.
EasyCurl.curl_session — Functioncurl_session(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_session() do client
response = http_request(client, "GET", "http://httpbin.org/get")
http_status(response)
end
200Utilities
EasyCurl.curl_joinurl — Functioncurl_joinurl(basepart::String, parts::String...) -> StringConstruct 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"