Class WebRequest

#include <Geode/utils/web.hpp>
classWebRequest{ ... }
No description provided
Examples0
Public static methods0
Public member functions32
geode::utils::web::WebTasksend(,)
No description provided
geode::utils::web::WebTaskpost()
No description provided
geode::utils::web::WebTaskget()
No description provided
geode::utils::web::WebTaskput()
No description provided
geode::utils::web::WebTaskpatch()
No description provided
geode::utils::web::WebRequest&removeHeader()
No description provided
geode::utils::web::WebRequest&param(,)
No description provided
template<integral T>geode::utils::web::WebRequest&param(,
Tvalue
)
No description provided
geode::utils::web::WebRequest&removeParam()
No description provided
geode::utils::web::WebRequest&userAgent()

Sets the request’s user agent. Defaults to not sending the User-Agent: header.

Parameters

name

Return value
WebRequest&
geode::utils::web::WebRequest&acceptEncoding(
std::string_viewencodingType
)

Sets the response’s encoding. Valid values include: br, gzip, deflate, … You can set multiple encoding types by calling this method with a comma separated list of the encodings of your choosing. Defaults to not sending an Accept-Encoding: header, and in turn, does not decompress received contents automatically.

Parameters

encodingType

Target response encoding type. An empty string ("") will use all built-in supported encodings.
Return value
WebRequest&
auto req = web::WebRequest()
 .acceptEncoding("gzip, deflate")
 .get(url);
geode::utils::web::WebRequest&timeout()

Sets the maximum amount of seconds to allow the entire transfer operation to take. The default timeout is 0, which means the request never times out during transfer.

Parameters

time

Return value
WebRequest&
geode::utils::web::WebRequest&downloadRange()

Sets the target byte range to request. Defaults to receiving the full request.

Parameters

byteRange

a pair of ints, first value is what byte to start from, second value is the last byte to get (both inclusive)
Return value
WebRequest&
geode::utils::web::WebRequest&certVerification(
boolenabled
)

Enable or disables peer verification in SSL handshake. The default is true.

Parameters

enabled

Return value
WebRequest&
geode::utils::web::WebRequest&transferBody(
boolenabled
)

Enables or disabled getting the body of a request. For HTTP(S), this does a HEAD request. For most other protocols it means just not asking to transfer the body data. The default is true.

Parameters

enabled

Return value
WebRequest&
geode::utils::web::WebRequest&followRedirects(
boolenabled
)

Follow HTTP 3xx redirects. The default is true.

Parameters

enabled

Return value
WebRequest&
geode::utils::web::WebRequest&ignoreContentLength(
boolenabled
)

Enables or disables ignoring the content length header. The default is false.

Parameters

enabled

Return value
WebRequest&
geode::utils::web::WebRequest&CABundleContent()

Sets the Certificate Authority (CA) bundle content. Defaults to not sending a CA bundle.

Parameters

content

Return value
WebRequest&
geode::utils::web::WebRequest&proxyOpts()

Sets the request’s proxy. Defaults to not using a proxy.

Parameters

proxyOpts

Return value
WebRequest&
geode::utils::web::WebRequest&version()

Sets the request’s HTTP version. The default is HttpVersion::VERSION_2TLS.

Parameters

httpVersion

Return value
WebRequest&
geode::utils::web::WebRequest&body()

Sets the body of the request to a byte vector.

Parameters

raw

The raw bytes to set as the body.
Return value
WebRequest&
geode::utils::web::WebRequest&bodyString()

Sets the body of the request to a string.

Parameters

str

The string to set as the body.
Return value
WebRequest&
geode::utils::web::WebRequest&bodyJSON()

Sets the body of the request to a json object.

Parameters

json

Return value
WebRequest&
_::size_tgetID()const

Gets the unique request ID

Return value
size_t
std::stringgetMethod()const

Gets the request method as a string

Return value
std::string
std::stringgetUrl()const

Gets the request URL

Return value
std::string
std::unordered_map<std::string,std::vector<std::string>>getHeaders()const

Gets the request headers

Return value
std::unordered_map<std::string, std::vector<std::string>>
std::unordered_map<std::string,std::string>getUrlParams()const

Gets the parameters inside the URL

Return value
std::unordered_map<std::string, std::string>
std::optional<geode::ByteVector>getBody()const

Gets the post body stream

Return value
std::optional<ByteVector>
std::optional<std::chrono::seconds>getTimeout()const

Gets the request timeout in seconds

Return value
std::optional<std::chrono::seconds>
geode::utils::web::HttpVersiongetHttpVersion()const

Gets HTTP versions applied to the request

Return value
HttpVersion
Fields0
Protected member functions0
Protected fields0