bool TestExtCurl::test_evhttp_post() { Variant ret = f_evhttp_post(String(get_request_uri()), "echo", make_packed_array("ECHO: foo")); VS(ret[s_code], 200); VS(ret[s_response], "POST: echo"); VS(ret[s_headers][0], "ECHOED: foo"); VS(ret[s_headers][4], "Content-Length: 10"); return Count(true); }
bool TestExtCurl::test_evhttp_post() { Variant ret = f_evhttp_post(String(get_request_uri()), "echo", CREATE_VECTOR1("ECHO: foo")); VS(ret["code"], 200); VS(ret["response"], "POST: echo"); VS(ret["headers"][0], "ECHOED: foo"); VS(ret["headers"][4], "Content-Length: 10"); return Count(true); }
bool TestExtCurl::test_evhttp_post_gzip() { // we fill up 2k to avoid the "oh it's < 1000 bytes, forget compression" // logic in Transport's implementation. char fullPostBody[2048]; memcpy(fullPostBody, "POST: ", 6); char* postBody = fullPostBody + 6; memset(postBody, 'a', sizeof(fullPostBody) - 7); fullPostBody[sizeof(fullPostBody) - 1] = '\0'; Variant ret = f_evhttp_post(String(get_request_uri()), postBody, make_packed_array("ECHO: foo", "Accept-Encoding: gzip")); VS(ret[s_code], 200); VS(ret[s_response], fullPostBody); VS(ret[s_headers][0], "ECHOED: foo"); VS(ret[s_headers][1], "Content-Encoding: gzip"); return Count(true); }