mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
Added remove methods to the web API
This commit is contained in:
parent
29dba46f1e
commit
72586f780d
2 changed files with 12 additions and 0 deletions
|
@ -125,11 +125,13 @@ namespace geode::utils::web {
|
|||
WebTask patch(std::string_view url);
|
||||
|
||||
WebRequest& header(std::string_view name, std::string_view value);
|
||||
WebRequest& removeHeader(std::string_view name);
|
||||
WebRequest& param(std::string_view name, std::string_view value);
|
||||
template <std::integral T>
|
||||
WebRequest& param(std::string_view name, T value) {
|
||||
return this->param(name, std::to_string(value));
|
||||
}
|
||||
WebRequest& removeParam(std::string_view name);
|
||||
|
||||
/**
|
||||
* Sets the request's user agent.
|
||||
|
|
|
@ -505,11 +505,21 @@ WebRequest& WebRequest::header(std::string_view name, std::string_view value) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
WebRequest& WebRequest::removeHeader(std::string_view name) {
|
||||
m_impl->m_headers.erase(std::string(name));
|
||||
return *this;
|
||||
}
|
||||
|
||||
WebRequest& WebRequest::param(std::string_view name, std::string_view value) {
|
||||
m_impl->m_urlParameters.insert_or_assign(std::string(name), std::string(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
WebRequest& WebRequest::removeParam(std::string_view name) {
|
||||
m_impl->m_urlParameters.erase(std::string(name));
|
||||
return *this;
|
||||
}
|
||||
|
||||
WebRequest& WebRequest::userAgent(std::string_view name) {
|
||||
m_impl->m_userAgent = name;
|
||||
return *this;
|
||||
|
|
Loading…
Reference in a new issue