How to disable URL encoding in Guzzle 6

匆匆过客 提交于 2019-12-25 03:09:05

问题


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

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.

Is there a way to disable URL encoding in Guzzle 6?


回答1:


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

Commit message:

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: "(", ")", "*", "!", "'"


来源:https://stackoverflow.com/questions/30865150/how-to-disable-url-encoding-in-guzzle-6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!