我正在构建一个 Spotify 应用程序,它使用像这样的 URL 从 REST API 中提取 JSON 数据
http://www.mydomain.com/api/command?option=value
在我的 Spotify 应用清单中,我为我的 API 主机设置了所需的权限:
"RequiredPermissions": [ "http://*.mydomain.com" ]
我还在我的 API 的响应标头中配置了跨域资源共享。这是一个真实的例子:
Server: nginx/0.7.65
Date: Thu, 08 Dec 2011 09:07:16 GMT
Content-Type: application/json
Connection: keep-alive
X-Powered-By: Mojolicious (Perl)
Set-Cookie: mojolicious=eyJwcmVmcyI6e30sImZpbHRlcnMiOnsicGllciI6eyJzb3VyY2VzIjpbMjBdfSwiZWxlYyI6eyJzb3VyY2VzIjpbMTMsMTddLCJ4dGFncyI6WyJzaG9lZ2F6ZSJdLCJ0YWdzIjpbImVsZWN0cm9uaWMiXX0sInB1bmtkdWIiOnsieHRhZ3MiOlsicmVnZ2FlIl0sInRhZ3MiOlsicHVuayIsImR1YiJdfX0sImV4cGlyZXMiOjEzMjMzMzg4MzZ9--c6d6214525b5d56785eebc99217394a1; Version=1; Path=/; expires=Thu, 08 Dec 2011 10:07:16 GMT
Content-Length: 23381
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET
Access-Control-Allow-Headers: *
200 OK
在 Spotify 的 chrome 检查器网络选项卡中,我看到请求被取消:
Name: command www.mydomain.net/api
Method: GET
Status Text: (canceled)
Type: undefined
Initiator: jquery-1.js:7180 (Script)
Size Content: 13B (0B)
Time Latency: 21ms (0.0 days)
如果我在桌面上的 Chrome 中运行我的应用程序(在 Spotify 之外),请求不会被取消并且一切都很好。
我究竟做错了什么?或者这可能是 Spotify 预览版中的一个错误(功能?)?