Flutter - Send Json over HTTP Post

后端 未结 3 1975
攒了一身酷
攒了一身酷 2021-01-12 23:39

I am trying to send a Json over HTTP post to update a record in my database. I\'ve connected to the server but I\'m getting a 415 \"Unsupported Media Type\" error when I run

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-13 00:19

    You are using incomplete headers for sending the json payload. That is why the server is not accepting you request.

    Use the following headers instead:

    headers: {
            "content-type" : "application/json",
            "accept" : "application/json",
          },
    

提交回复
热议问题