我试图使用POST方法(Revenue REST API(,但我总是收到错误消息";内容类型不是application/json";。
The strange is that I'm using their website to test: [https://docs.revenuecat.com/reference#receipts][1]
API测试(图像(
curl --request POST
--url https://api.revenuecat.com/v1/receipts
--header 'Accept: application/json'
--header 'Authorization: Bearer xxxx'
--header 'Content-Type: application/json'
--header 'X-Platform: android'
--data '
{
"product_id": "xxxx",
"price": 12.9,
"currency": "BRL",
"is_restore": "false",
"app_user_id": "xxxx",
"fetch_token": "xxxxxx"
}
'
有线索吗?
我已经使用CURL运行了代码,它很有效。revenuecat网站出现问题。
他们的API测试页面有一个bug。它增加了一个额外的Content-Type: application/json
标头到请求。你可以在Metadata
标签上看到它
Request Headers
Accept: application/json
Content-Type: application/json
X-Platform: stripe
Content-Type: application/json
Authorization: Bearer ********************
User-Agent: ReadMe-API-Explorer
并发送带有无效标头的请求(您可以在浏览器网络流量中进行检查(:
content-type: application/json, application/json