如何在Guzzle 6中禁用URL编码 [英] How to disable URL encoding in Guzzle 6
本文介绍了如何在Guzzle 6中禁用URL编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用pipedrive API,我想发出这样的请求:
I'm working with pipedrive API and I want to make such a request:
GET https://api.pipedrive.com/v1/deals(id,title,value,currency)?api_token=YOUR_API_TOKEN
它工作正常,例如.当我使用浏览器执行请求时,但是当我使用Guzzle发送请求时,我收到响应501.我假定它以Pipedrive API无法识别的方式进行编码.
It works fine eg. when I do the request with a browser, but when I send the request with Guzzle I get response 501. I assume that it gets encoded in a way that's not recognized by Pipedrive API.
有没有办法在Guzzle 6中禁用URL编码?
Is there a way to disable URL encoding in Guzzle 6?
推荐答案
似乎是一个错误,我不是唯一面临此问题的人:
Seems like this is a bug and I'm not the only one facing this issue:
- https://github.com/guzzle/guzzle/issues/1121
- https://github.com/guzzle/psr7/commit/962735c754f2a562a619b456a3aa4e614f0e5360/li>
提交消息:
Fixing path URI encoding.
The previous pattern was incorrect:
'/(?:[^' . self::$charUnreserved . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/'
The new pattern now properly follows RFC 3986:
/(?:[^a-zA-Z0-9_\-\.~!\$&'\(\)\*\+,;=:@\/%]+|%(?![A-Fa-f0-9]{2}))/
This pattern now allows the following characters: "(", ")", "*", "!", "'"
这篇关于如何在Guzzle 6中禁用URL编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文