mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Use QByteArray directly in HTTPRequest::set_{payload,header}
This commit is contained in:
parent
557e50f310
commit
16da304d78
|
@ -69,18 +69,15 @@ void HTTPRequest::finally(sol::protected_function func)
|
||||||
this->cbFinally = std::make_optional(func);
|
this->cbFinally = std::make_optional(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTTPRequest::set_payload(const std::string &payload)
|
void HTTPRequest::set_payload(QByteArray payload)
|
||||||
{
|
{
|
||||||
this->req_ =
|
this->req_ = std::move(this->req_).payload(payload);
|
||||||
std::move(this->req_).payload(QByteArray::fromStdString(payload));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// name and value may be random bytes
|
// name and value may be random bytes
|
||||||
void HTTPRequest::set_header(std::string name, std::string value)
|
void HTTPRequest::set_header(QByteArray name, QByteArray value)
|
||||||
{
|
{
|
||||||
this->req_ = std::move(this->req_)
|
this->req_ = std::move(this->req_).header(name, value);
|
||||||
.header(QByteArray::fromStdString(name),
|
|
||||||
QByteArray::fromStdString(value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<HTTPRequest> HTTPRequest::create(sol::this_state L,
|
std::shared_ptr<HTTPRequest> HTTPRequest::create(sol::this_state L,
|
||||||
|
|
|
@ -96,7 +96,7 @@ public:
|
||||||
* @lua@param data string
|
* @lua@param data string
|
||||||
* @exposed HTTPRequest:set_payload
|
* @exposed HTTPRequest:set_payload
|
||||||
*/
|
*/
|
||||||
void set_payload(const std::string &payload);
|
void set_payload(QByteArray payload);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a header in the request
|
* Sets a header in the request
|
||||||
|
@ -105,7 +105,7 @@ public:
|
||||||
* @lua@param value string
|
* @lua@param value string
|
||||||
* @exposed HTTPRequest:set_header
|
* @exposed HTTPRequest:set_header
|
||||||
*/
|
*/
|
||||||
void set_header(std::string name, std::string value);
|
void set_header(QByteArray name, QByteArray value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the HTTP request
|
* Executes the HTTP request
|
||||||
|
|
Loading…
Reference in a new issue