This API does not support parsing form-encoded input

后端 未结 1 1585
庸人自扰
庸人自扰 2020-12-31 01:07

I tried to submit data to an endpoint but it said the data size was too large, so I changed the method to POST and received the error:

This API does not supp         


        
相关标签:
1条回答
  • 2020-12-31 01:30

    Not sure if your problem is related, but I received the "This API does not support parsing form-encoded input." error when I was attempting to use curl to send a POST message like this:

    curl -X POST -d '{"name": "Foo"}' http://foo.appspot.com/_ah/api/foo/1/endpoint
    

    The problem was that I was not setting the content type. curl POSTs with Content-Type: application/x-www-form-urlencoded if it's not specified on the command line. Google cloud endpoints don't accept this content type.

    When I changed the curl invocation to include the content type, it worked:

    curl -X POST -d '{"name": "Foo"}' --header "Content-Type: application/json" http://foo.appspot.com/_ah/api/foo/1/endpoint
    
    0 讨论(0)
提交回复
热议问题