Serial.begin(9600);
ESP esp(&Wifi);
Wifi.begin();
REST rest(&esp);
Serial.println(rest.begin(MYIP));
rest.get("/", "");
char data[256];
Serial.println(rest.getResponse(data, 256)); // prints the status code or 0 on failure
Serial.println(data);
When trying to do the same with a post
Serial.begin(9600);
ESP esp(&Wifi);
Wifi.begin();
REST rest(&esp);
Serial.println(rest.begin(MYIP));
rest.post("/", "POSTBODY");
char data[256];
Serial.println(rest.getResponse(data, 256)); // prints the status code or 0 on failure
Serial.println(data);
The request is being made but the post body is always empty. I'm not sure if it's a bug, or if I'm using it wrong.
Lastly, how is the HTTP request being formed, who sets the all of headers (content-type/ content-length etc.). I wasn't able to find anything in the source code about it.
So I got this to work:
When trying to do the same with a post
The request is being made but the post body is always empty. I'm not sure if it's a bug, or if I'm using it wrong.
Lastly, how is the HTTP request being formed, who sets the all of headers (content-type/ content-length etc.). I wasn't able to find anything in the source code about it.