Closed
Description
Must call .encode('utf-8')
if body text contains Chinese:
import requests, json
json_text = json.dumps({"id":"test", "name":"esp32-中文-1"}).encode('utf-8')
response = requests.post('https://mc-th.alx6963445.workers.dev/device', headers = {'X-Custom-UUID': 'test', 'X-Custom-TOKEN':'test'}, data = json_text)
print(response.status_code, response.text)
response.close()
If not call .encode('utf-8')
, workers can not receive full body text. The content will be garbled.
Will the problem be solved after setting ; charset=UTF-8
to Content-Type ? https://github.com/micropython/micropython-lib/blob/master/python-ecosys/requests/requests/__init__.py#L110
Metadata
Metadata
Assignees
Labels
No labels