croservices / cro-core

The heart of the Cro library for building distributed systems in Raku, including pipeline composition and TCP support.
https://cro.services/
Artistic License 2.0
27 stars 9 forks source link

Url encoding in Get, Put, Post and Delete requests #35

Closed wbiker closed 2 years ago

wbiker commented 2 years ago

Given urls to Cro::HTTP::Client will be url encoded and thus break on server side.

# netcat -l localhost 7788 & # raku -MCro::HTTP::Client -e 'await Cro::HTTP::Client.delete("http://localhost:7788/foo/bar?foo=1&bar=2")'

That yields: DELETE /foo/bar?foo=1%26bar=2 HTTP/1.1 But expected is DELETE /foo/bar?foo=1&bar=2 HTTP/1.1

The same for Get, Put and Post requests.

As a workaround Cro::Uri can be use: # raku -MCro::HTTP::Client -e 'await Cro::HTTP::Client.delete(Cro::Uri.parse("http://localhost:7788/foo/bar?foo=1&bar=2"))'

OS: opensuse linux Leap 15.3 Raku: v2022.02 Cro: Cro::Core:ver<0.8.7>