Accessing the body content may be done by calling the function request->read_content. The content will be accessible with request->content and request->content_length:
#include "CWebStudioOne.c"
CwebNamespace cweb;
CwebHttpResponse *main_sever(CwebHttpRequest *request ){
int one_mega_byte = 1048576;
unsigned char *body = cweb.request.read_content(request, one_mega_byte);
if(body){
printf("body: %s",(char*)body);
return cweb_send_text("Body Readed", 200);
}
return cweb_send_text("Body Not Readed", 200);
}
int main(int argc, char *argv[]){
cweb = newCwebNamespace();
CwebServer server = newCwebSever(5000, main_sever);
cweb.server.start(&server);
return 0;
}
This example shows how to read the body content of the request.