request.format returning */*

前端 未结 2 1794
攒了一身酷
攒了一身酷 2021-01-02 12:38

I\'m currently developing an API for my application on RoR

As an example, I created some XML, loaded with all the info I need to create the object, let\'s say a Pers

2条回答
  •  天涯浪人
    2021-01-02 12:58

    */* simply means that all MIME types are accepted.

    Looking at the code for the request.format method, the MIME type is determined by the file extension, or if that's not present then by the value of the HTTP Accept header. So you either need to pass Curl an XML file saved to disk, or get Curl to set the Accept header to an XML MIME type (e.g. text/xml) when it makes the request to your API.

提交回复
热议问题