0

I have a pound/hash symbol in a query string and while sending the get request with PHP Guzzle 6 it is not being encoded properly. A sample request:

https://10.1.10.1/vmrest/users?query=(alias%20is%20UserWithAPoundSign%2318)

is sent as:

https://10.1.10.1/vmrest/users?query=(alias%20is%20UserWithAPoundSign#18)

I see there was some work in relation to this issue:

How to disable URL encoding in Guzzle 6

but it doesn't look like the pound/hash is accounted for. Is this a bug or something I'm doing wrong?

Community
  • 1
  • 1
lefty29er
  • 41
  • 5
  • what version of guzzle are you using? it looks like [it was fixed](https://github.com/guzzle/guzzle/issues/1121#issuecomment-111765449) in psr7 – DevDonkey Jul 12 '16 at 13:54
  • It's Guzzle 6.2.0. I checked out the commit and I don't see anything specifically for the pound symbol in that update. – lefty29er Jul 12 '16 at 14:18
  • Why should you have a `#` in request URI? – revo Jul 13 '16 at 06:58
  • I'm querying an API based on user 'alias', which contain `#`. Realizing I was a bit short sighted since the uri fragment uses `#`, would it be possible to have a client option to toggle whether the `#` is treated as a fragment or literal `#` as part of a query string? I have to imagine with REST API's this would come up once in a while. In my application I'll never be using this as a fragment so the Guzzle client could encode it for me instead of treating as a fragment. – lefty29er Jul 14 '16 at 11:52

0 Answers0