increased chunk size

Dependencies:   HTTPClient-SSL

Fork of MTS-Socket by MultiTech

Revision:
8:a3b41ec82e63
Parent:
7:08b474178245
Child:
9:b2e3862705fc
--- a/Test/TestHTTP.h	Tue Jun 03 14:49:26 2014 +0000
+++ b/Test/TestHTTP.h	Mon Jun 16 14:05:19 2014 +0000
@@ -18,35 +18,35 @@
     HTTPClient* http;
     char sbuf[1024];
     char rbuf[1024];
-    HTTPText* send;
+    HTTPMap* send;
     HTTPText* receive;
 };
 
 TestHTTP::TestHTTP() : TestCollection("TestHTTP") {}
 
 void TestHTTP::run() {
-    string data;
     string url;
     string base_url = "http://httpbin.org:80";
     string url_get = "/get";
     string url_put = "/put";
     string url_post = "/post";
     string url_del = "/delete";
+    string url_stream = "/stream/20";
     
     MTSLog::setLogLevel(MTSLog::TRACE_LEVEL);
     
     Test::start("Setup");
-    io = new MTSSerialFlowControl(PTD3, PTD2, PTA12, PTC8);
+    io = new MTSSerialFlowControl(D8, D2, D3, D6);
     io->baud(115200);
     radio = CellularFactory::create(io);
     if (! radio) {
         Test::assertTrue(false);
     }
-    radio->configureSignals(PTA4, PTC9, PTA20);
+    radio->configureSignals(D4, D7, RESET);
     Transport::setTransport(radio);
     
     http = new HTTPClient();
-    send = new HTTPText(sbuf);
+    send = new HTTPMap();
     receive = new HTTPText(rbuf);
     
     for (int i = 0; i < 10; i++) {
@@ -90,33 +90,37 @@
     Test::end();
     
     url = base_url + url_put;
-    data = "testing HTTP PUT method";
     Test::start("HTTP PUT");
     logInfo("testing PUT");
-    strncpy(sbuf, data.c_str(), sizeof(sbuf));
+    send->put("testing", "put");
     Test::assertTrue(http->put(url.c_str(), *send, receive, 5000) == HTTP_OK);
-    Test::assertTrue(string(rbuf).find(data) != string::npos);
     logInfo("done testing PUT");
     Test::end();
     
     url = base_url + url_post;
-    data = "testing HTTP POST method";
     Test::start("HTTP POST");
     logInfo("testing POST");
-    strncpy(sbuf, data.c_str(), sizeof(sbuf));
+    send->put("testing", "put");
     Test::assertTrue(http->post(url.c_str(), *send, receive, 5000) == HTTP_OK);
-    Test::assertTrue(string(rbuf).find(data) != string::npos);
     logInfo("done testing POST");
     Test::end();
     
     url = base_url + url_del;
-    data = "testing HTTP DELETE method";
     Test::start("HTTP DELETE");
     logInfo("testing DELETE");
     Test::assertTrue(http->del(url.c_str(), receive, 5000) == HTTP_OK);
     logInfo("done testing DELETE");
     Test::end();
     
+    url = base_url + url_stream;
+    char bigbuf[8 * 1024];
+    HTTPText big(bigbuf);
+    Test::start("HTTP big GET");
+    logInfo("testing big GET");
+    Test::assertTrue(http->get(url.c_str(), &big, 5000) == HTTP_OK);
+    logInfo("done testing big GET");
+    Test::end();
+    
     radio->disconnect();
 }