(ws curl) Add support for --data-binary option, to set the request body. When present the request will be sent with the POST verb
This commit is contained in:
parent
67cb48537a
commit
b2f21840c6
@ -2,6 +2,10 @@
|
||||
|
||||
All changes to this project will be documented in this file.
|
||||
|
||||
## [10.5.2] - 2020-10-12
|
||||
|
||||
(ws curl) Add support for --data-binary option, to set the request body. When present the request will be sent with the POST verb
|
||||
|
||||
## [10.5.1] - 2020-10-09
|
||||
|
||||
(http client + server + ws) Add support for compressing http client requests with gzip. --compress_request argument is used in ws to enable this. The Content-Encoding is set to gzip, and decoded on the server side if present.
|
||||
|
@ -588,7 +588,6 @@ namespace ix
|
||||
return request(url, verb, body, args);
|
||||
}
|
||||
|
||||
|
||||
HttpResponsePtr HttpClient::post(const std::string& url,
|
||||
const HttpParameters& httpParameters,
|
||||
const HttpFormDataParameters& httpFormDataParameters,
|
||||
|
@ -6,4 +6,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define IX_WEBSOCKET_VERSION "10.5.1"
|
||||
#define IX_WEBSOCKET_VERSION "10.5.2"
|
||||
|
15
ws/ws.cpp
15
ws/ws.cpp
@ -1531,6 +1531,7 @@ namespace ix
|
||||
const std::string& headersData,
|
||||
const std::string& data,
|
||||
const std::string& formData,
|
||||
const std::string& dataBinary,
|
||||
bool headersOnly,
|
||||
int connectTimeout,
|
||||
int transferTimeout,
|
||||
@ -1572,10 +1573,19 @@ namespace ix
|
||||
{
|
||||
response = httpClient.head(url, args);
|
||||
}
|
||||
else if (data.empty() && formData.empty())
|
||||
else if (data.empty() && formData.empty() && dataBinary.empty())
|
||||
{
|
||||
response = httpClient.get(url, args);
|
||||
}
|
||||
else if (!dataBinary.empty())
|
||||
{
|
||||
std::string body = dataBinary;
|
||||
if (compressRequest)
|
||||
{
|
||||
body = gzipCompress(dataBinary);
|
||||
}
|
||||
response = httpClient.request(url, "POST", body, args, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
response = httpClient.post(url, httpParameters, httpFormDataParameters, args);
|
||||
@ -2981,6 +2991,7 @@ int main(int argc, char** argv)
|
||||
std::string user;
|
||||
std::string data;
|
||||
std::string formData;
|
||||
std::string binaryData;
|
||||
std::string headers;
|
||||
std::string output;
|
||||
std::string hostname("127.0.0.1");
|
||||
@ -3193,6 +3204,7 @@ int main(int argc, char** argv)
|
||||
httpClientApp->add_option("url", url, "Connection url")->required();
|
||||
httpClientApp->add_option("-d", data, "Form data")->join();
|
||||
httpClientApp->add_option("-F", formData, "Form data")->join();
|
||||
httpClientApp->add_option("--data-binary", binaryData, "Body binary data")->join();
|
||||
httpClientApp->add_option("-H", headers, "Header")->join();
|
||||
httpClientApp->add_option("--output", output, "Output file");
|
||||
httpClientApp->add_flag("-I", headersOnly, "Send a HEAD request");
|
||||
@ -3518,6 +3530,7 @@ int main(int argc, char** argv)
|
||||
headers,
|
||||
data,
|
||||
formData,
|
||||
binaryData,
|
||||
headersOnly,
|
||||
connectTimeOut,
|
||||
transferTimeout,
|
||||
|
Loading…
Reference in New Issue
Block a user