Getting error when using axios POST

后端 未结 1 1141
温柔的废话
温柔的废话 2021-01-29 10:20

My url, headers and body data are defined as:

var headers = {
    \'Authorization\': \'Bearer 12345\',
    \'Content-Type\': \'application/x-www-form-urlencoded\         


        
相关标签:
1条回答
  • 2021-01-29 11:16

    This is, sadly, an educated guess because a MCVE was not provided.

    See the documentation for axios:

    By default, axios serializes JavaScript objects to JSON. To send data in the application/x-www-form-urlencoded format instead, you can use one of the following options.

    You are setting a Content-Type header which claims you are sending application/x-www-form-urlencoded data, but you haven't done any of the things that the documentation suggests to generate data in that format.

    0 讨论(0)
提交回复
热议问题