I’ve been trying to post images to an HTTP end point from my Wio Terminal. I have a buffer of about 9KB in size. When I post this, it doesn’t post all the data, and I get an error on my server code showing an unexpected end of request content.
I’ve tried buffers at a few different sizes:
1KB - sends fine
2KB - sends fine
4KB - unexpected end of request content
It looks like somewhere in the firmware there is a limit on how many bytes get sent. I get the same on WifiClient and WifiClientSecure.
This is my code:
HTTPClient httpClient;
httpClient.begin(client, ENDPOINT);
httpClient.addHeader("Content-Type", "application/octet-stream");
length = 1024;
byte buff[length];
int httpResponseCode = httpClient.POST(buff, length);
If length
is 1 or 2KB, then I get a 200 back. If it is 4KB or above, I get -3 back (HTTPC_ERROR_SEND_PAYLOAD_FAILED
). Digging into the code, and the error is kErpcStatus_BufferOverrun
.
Any ideas? I’m trying to send an image to a cloud AI service, so need to make a single call with the data.