When I used urequests on NodeMCU to POST JSON data to a server,it failed and the server sent back the state info:{"detail": "Unsupported media type \'\' in request."}'.
When I checked urequests code on github,I found that there is no Content-Type: application/json
Here is the code quote:
if json is not None:
assert data is None
import ujson
data = ujson.dumps(json)
if data:
s.write(b"Content-Length: %d\r\n" % len(data))
s.write(b"\r\n")
if data:
s.write(data)
When I used
urequestson NodeMCU to POST JSON data to a server,it failed and the server sent back the state info:{"detail": "Unsupported media type \'\' in request."}'.When I checked
urequestscode on github,I found that there is noContent-Type: application/jsonHere is the code quote: