HTTPClient

Dependents:   MQTT_G_SENSOR

Fork of HTTPClient by Donatien Garnier

Revision:
19:92048f7dbfda
Parent:
16:1f743885e7de
--- a/HTTPClient.cpp	Thu Aug 30 15:38:57 2012 +0000
+++ b/HTTPClient.cpp	Wed Aug 12 02:39:24 2015 +0000
@@ -97,6 +97,11 @@
   return m_httpResponseCode;
 }
 
+int HTTPClient::setHTTPExtenHeader(const char *header )
+{
+    strcpy(extendheader,header);
+}
+
 #define CHECK_CONN_ERR(ret) \
   do{ \
     if(ret) { \
@@ -160,7 +165,7 @@
   DBG("Sending request");
   char buf[CHUNK_SIZE];
   const char* meth = (method==HTTP_GET)?"GET":(method==HTTP_POST)?"POST":(method==HTTP_PUT)?"PUT":(method==HTTP_DELETE)?"DELETE":"";
-  snprintf(buf, sizeof(buf), "%s %s HTTP/1.1\r\nHost: %s\r\n", meth, path, host); //Write request
+  snprintf(buf, sizeof(buf), "%s %s HTTP/1.1\r\nHost: %s\r\ndeviceKey: atYuvPIKvzJdKixe\r\n", meth, path, host); //Write request
   ret = send(buf);
   if(ret)
   {
@@ -187,9 +192,11 @@
       CHECK_CONN_ERR(ret);
     }
     char type[48];
-    if( pDataOut->getDataType(type, 48) == HTTP_OK )
+    //if( pDataOut->getDataType(type, 48) == HTTP_OK )
     {
-      snprintf(buf, sizeof(buf), "Content-Type: %s\r\n", type);
+      //snprintf(buf, sizeof(buf), "Content-Type: %s\r\n", type);
+      snprintf(buf, sizeof(buf), "Content-Type: text/csv\r\n");
+      
       ret = send(buf);
       CHECK_CONN_ERR(ret);
     }