From: James Turner Date: Sat, 17 Nov 2012 19:51:57 +0000 (+0000) Subject: Fix HTTP test for revised POST semantics. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2aed93a576f953811198a60a5b8adda01631158e;p=simgear.git Fix HTTP test for revised POST semantics. --- diff --git a/simgear/io/test_HTTP.cxx b/simgear/io/test_HTTP.cxx index 43d660c3..b9207c7a 100644 --- a/simgear/io/test_HTTP.cxx +++ b/simgear/io/test_HTTP.cxx @@ -53,11 +53,13 @@ public: bool complete; bool failed; string bodyData; + string bodyContentType; TestRequest(const std::string& url, const std::string method = "GET") : HTTP::Request(url, method), complete(false) { + bodyContentType = "text/plain"; } std::map sendHeaders; @@ -103,6 +105,11 @@ protected: bodyData += string(s, n); } + virtual std::string requestBodyType() const + { + return bodyContentType; + } + virtual void responseHeader(const string& header, const string& value) { headers[header] = value; @@ -696,6 +703,8 @@ int main(int argc, char* argv[]) { cout << "POST" << endl; TestRequest* tr = new TestRequest("http://localhost:2000/test_post?foo=abc&bar=1234&username=johndoe", "POST"); + tr->bodyContentType = "application/x-www-form-urlencoded"; + HTTP::Request_ptr own(tr); cl.makeRequest(tr); waitForComplete(&cl, tr);