libwebsockets icon indicating copy to clipboard operation
libwebsockets copied to clipboard

How can I get content data of http post request

Open jiangb1120 opened this issue 1 year ago • 1 comments

I used the minimal-examples/http-server/minimal-http-server-form-post and https://reqbin.com/ to test http post. On the reqbin side, I did that as below: http://10.86.24.44:7681/1.0.0/data/heartbeat POST EXT SEND Content {"DeviceNo":"radar-01-04","Time":"2022-01-18 15:17:54.422","Data":{"Voltage":0,"Temperature":[0,0],"Interference":0}} Raw POST /1.0.0/data/heartbeat HTTP/1.1 Host: 10.86.24.44 Content-Type: application/json Content-Length: 117

{"DeviceNo":"radar-01-04","Time":"2022-01-18 15:17:54.422","Data":{"Voltage":0,"Temperature":[0,0],"Interference":0}}

On the lws-minimal-http-server-form-post side, I print (const char*)in on the case LWS_CALLBACK_HTTP and LWS_CALLBACK_HTTP_BODY, but it only print the info "/1.0.0/data/hearbeat" on the case LWS_CALLBACK_HTTP , did not print any info on the case LWS_CALLBACK_HTTP_BODY . I just want to get the json data of the body of the post data, Any suggestion?

jiangb1120 avatar May 31 '23 09:05 jiangb1120

@jiangb1120 have run into exactly the same concern, did You find the way to read body content?

AlojzyB avatar Jan 30 '24 16:01 AlojzyB