gpt4 book ai didi

javascript - PUT 请求仅在 Chrome 或 Opera 中生成 SPDY 协议(protocol)错误?

转载 作者:搜寻专家 更新时间:2023-11-01 04:29:55 26 4
gpt4 key购买 nike

我有一个使用 Angular $resource provider 的 Angular 1.5 应用程序处理对 API 后端的所有调用。我最近添加了一个具有拖放界面的功能,一旦将一个项目放入特定的存储桶中,我就会执行一个 PUT 请求,将所有相关数据发送到公共(public) API 方法以保存所述数据。

几个月前我开发了它,甚至在一个特定版本(我们已经有 2 或 3 个版本)的 Chrome 的 Mac-only 版本中发现了一个奇怪的错误,但除此之外它工作得很好。

我最近在自己做了更多测试后才发布它,才意识到 Chrome 和 Opera 浏览器在 PUT 调用时都出错,API 从未收到请求。我得到的唯一信息是 Chrome 控制台中的这段描述:

PUT https://www.phpdraft.com/api/draft/59/pick/5026/depth_chart/37 net::ERR_SPDY_PROTOCOL_ERROR

要亲自查看,这里是可以进行该调用或类似调用的 URL:PHPDraft

我怀疑我的服务器正在使用 HTTPS 的事实可能是这里的问题,但我在 ERR_SPDY_PROTOCOL_ERROR 上所做的 Google 搜索到目前为止充其量是神秘的并且听起来不合理好像它们适用于我的情况。

下面是我如何在我的 Angular 应用程序中使用 $resource 来进行此 PUT 调用(以及所有其他类似的调用):

angular.module('app').factory('api', function($resource, ENV) {
return {
DepthChartPosition: $resource(ENV.apiEndpoint + "commish/draft/:id/depthchartposition/:position_id", {
draft_id: '@draft_id',
position_id: '@position_id',
draft_sport: '@draft_sport',
manager_id: '@manager_id',
pick_id: '@pick_id'
}, {
'update': {
method: 'PUT',
url: ENV.apiEndpoint + "draft/:draft_id/pick/:pick_id/depth_chart/:position_id"
}
})
};
});

下面是上面代码生成的请求本身:

General
Request URL: https://www.phpdraft.com/api/draft/59/pick/5026/depth_chart/37

Request Headers
Accept:application/json, text/plain, */\*
Content-Type: application/json;charset=UTF-8
Origin: https://www.phpdraft.com
Referer: https://www.phpdraft.com/draft/59/depth_chart
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36

Request Payload
{draft_id: "59", position_id: "37", pick_id: "5026"}

此请求的响应窗口为空,devtools 将请求显示为“已停止”。知道这里发生了什么吗?

最佳答案

截至今年 5 月 15 日,Chrome no longer supports SPDY并且不再包含在当前版本中。

... starting on May 15th — the anniversary of the HTTP/2 RFC — Chrome will no longer support SPDY.

...SPDY and NPN support will be removed with the release of Chrome 51.

关于javascript - PUT 请求仅在 Chrome 或 Opera 中生成 SPDY 协议(protocol)错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38986585/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com