mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-10 09:43:51 +00:00
Test code cleanup
This commit is contained in:
parent
eaafa5d55c
commit
b5a1d52f36
41
test/test.cc
41
test/test.cc
@ -976,27 +976,36 @@ TEST_F(ServerTest, MultipartFormData) {
|
|||||||
req.headers.emplace("Host", host_and_port.c_str());
|
req.headers.emplace("Host", host_and_port.c_str());
|
||||||
req.headers.emplace("Accept", "*/*");
|
req.headers.emplace("Accept", "*/*");
|
||||||
req.headers.emplace("User-Agent", "cpp-httplib/0.1");
|
req.headers.emplace("User-Agent", "cpp-httplib/0.1");
|
||||||
|
|
||||||
req.headers.emplace(
|
req.headers.emplace(
|
||||||
"Content-Type",
|
"Content-Type",
|
||||||
"multipart/form-data; boundary=----WebKitFormBoundarysBREP3G013oUrLB4");
|
"multipart/form-data; boundary=----WebKitFormBoundarysBREP3G013oUrLB4");
|
||||||
|
|
||||||
req.body =
|
req.body =
|
||||||
"------WebKitFormBoundarysBREP3G013oUrLB4\r\nContent-Disposition: "
|
"------WebKitFormBoundarysBREP3G013oUrLB4\r\n"
|
||||||
"form-data; name=\"text1\"\r\n\r\ntext "
|
"Content-Disposition: form-data; name=\"text1\"\r\n"
|
||||||
"default\r\n------WebKitFormBoundarysBREP3G013oUrLB4\r\nContent-"
|
"\r\n"
|
||||||
"Disposition: form-data; "
|
"text default\r\n"
|
||||||
"name=\"text2\"\r\n\r\naωb\r\n------"
|
"------WebKitFormBoundarysBREP3G013oUrLB4\r\n"
|
||||||
"WebKitFormBoundarysBREP3G013oUrLB4\r\nContent-Disposition: form-data; "
|
"Content-Disposition: form-data; name=\"text2\"\r\n"
|
||||||
"name=\"file1\"; filename=\"hello.txt\"\r\nContent-Type: "
|
"\r\n"
|
||||||
"text/"
|
"aωb\r\n"
|
||||||
"plain\r\n\r\nh\ne\n\nl\nl\no\n\r\n------"
|
"------WebKitFormBoundarysBREP3G013oUrLB4\r\n"
|
||||||
"WebKitFormBoundarysBREP3G013oUrLB4\r\nContent-Disposition: form-data; "
|
"Content-Disposition: form-data; name=\"file1\"; filename=\"hello.txt\"\r\n"
|
||||||
"name=\"file2\"; filename=\"world.json\"\r\nContent-Type: "
|
"Content-Type: text/plain\r\n"
|
||||||
"application/json\r\n\r\n{\n \"world\", "
|
"\r\n"
|
||||||
"true\n}\n\r\n------WebKitFormBoundarysBREP3G013oUrLB4\r\ncontent-"
|
"h\ne\n\nl\nl\no\n\r\n"
|
||||||
"disposition: form-data; name=\"file3\"; filename=\"\"\r\ncontent-type: "
|
"------WebKitFormBoundarysBREP3G013oUrLB4\r\n"
|
||||||
"application/"
|
"Content-Disposition: form-data; name=\"file2\"; filename=\"world.json\"\r\n"
|
||||||
"octet-stream\r\n\r\n\r\n------WebKitFormBoundarysBREP3G013oUrLB4--\r\n";
|
"Content-Type: application/json\r\n"
|
||||||
|
"\r\n"
|
||||||
|
"{\n \"world\", true\n}\n\r\n"
|
||||||
|
"------WebKitFormBoundarysBREP3G013oUrLB4\r\n"
|
||||||
|
"content-disposition: form-data; name=\"file3\"; filename=\"\"\r\n"
|
||||||
|
"content-type: application/octet-stream\r\n"
|
||||||
|
"\r\n"
|
||||||
|
"\r\n"
|
||||||
|
"------WebKitFormBoundarysBREP3G013oUrLB4--\r\n";
|
||||||
|
|
||||||
auto res = std::make_shared<Response>();
|
auto res = std::make_shared<Response>();
|
||||||
auto ret = cli_.send(req, *res);
|
auto ret = cli_.send(req, *res);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user