Skip to content

Commit d8ed644

Browse files
committed
Testing querystring parser
1 parent 2076fba commit d8ed644

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/integ/basic.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class args_resource : public http_resource
6363
public:
6464
const http_response render_GET(const http_request& req)
6565
{
66-
return http_response_builder(req.get_arg("arg"), 200, "text/plain").string_response();
66+
return http_response_builder(req.get_arg("arg") + req.get_arg("arg2"), 200, "text/plain").string_response();
6767
}
6868
};
6969

@@ -510,6 +510,24 @@ LT_BEGIN_AUTO_TEST(basic_suite, regex_matching_arg_custom)
510510
}
511511
LT_END_AUTO_TEST(regex_matching_arg_custom)
512512

513+
LT_BEGIN_AUTO_TEST(basic_suite, querystring_processing)
514+
args_resource* resource = new args_resource();
515+
ws->register_resource("this/captures/args/passed/in/the/querystring", resource);
516+
curl_global_init(CURL_GLOBAL_ALL);
517+
518+
std::string s;
519+
CURL *curl = curl_easy_init();
520+
CURLcode res;
521+
curl_easy_setopt(curl, CURLOPT_URL, "localhost:8080/this/captures/args/passed/in/the/querystring?arg=first&arg2=second");
522+
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
523+
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefunc);
524+
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &s);
525+
res = curl_easy_perform(curl);
526+
LT_ASSERT_EQ(res, 0);
527+
LT_CHECK_EQ(s, "firstsecond");
528+
curl_easy_cleanup(curl);
529+
LT_END_AUTO_TEST(querystring_processing)
530+
513531
LT_BEGIN_AUTO_TEST_ENV()
514532
AUTORUN_TESTS()
515533
LT_END_AUTO_TEST_ENV()

0 commit comments

Comments
 (0)