EC200 http post body as json

Dear Team,

I’m using EC200U-CN, OpenCPU to send Json data as body in http post service. Unfortunately, Its not working for me. I have tried all kinds of different request options available in http header file.

For your reference, I’m attaching below image.

Hi @SURYA2932
If you configure it to use raw request, you should also specify a file that contains the complete HTTP request. And there would be no need to configure request headers as you would just place them in your raw request.
The http post demo should show how to do so.

If you wish to use READ_DATA instead of raw request, apart from setting HTTP_CLIENT_OPT_READ_DATA, you also need to set HTTP_CLIENT_OPT_READ_FUNC and assign a callback function to it.

For example:

static int http_read_request_data(http_client_t *client, void *arg, char *data, int size)
{
	QL_HTTP_LOG("http_read_request_data size: %d,data: %s", size, (char *)arg);
	strncpy(data, (char *)arg, size);
	return size;
}
....
....
ql_httpc_setopt(&http_cli, HTTP_CLIENT_OPT_READ_FUNC, http_read_request_data);
ql_httpc_setopt(&http_cli, HTTP_CLIENT_OPT_READ_DATA, bodydata);