Skip to content

urequests' POST method lacks "Content-Type" #172

@green-dalii

Description

@green-dalii

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions