kopia lustrzana https://github.com/micropython/micropython-lib
urequests: Set Content-Type to application/json when json param is used.
Otherwise, some servers don't recognize the payload as JSON.pull/239/merge
rodzic
f971582069
commit
6c141990ac
|
@ -71,6 +71,7 @@ def request(method, url, data=None, json=None, headers={}, stream=None):
|
|||
assert data is None
|
||||
import ujson
|
||||
data = ujson.dumps(json)
|
||||
s.write(b"Content-Type: application/json\r\n")
|
||||
if data:
|
||||
s.write(b"Content-Length: %d\r\n" % len(data))
|
||||
s.write(b"\r\n")
|
||||
|
|
Ładowanie…
Reference in New Issue