perl6 -MCro::HTTP::Client -e 'my $client = Cro::HTTP::Client.new;my $url = "https://cs85.salesforce.com/services/data/v40.0/query/?q=SELECT+id,RecordTypeId,Name+FROM+Account+WHERE+RecordTypeId+IN+%28%27012b0000000UTlhAAG%27,%27012b0000000UTlfAAG%27,%27012b0000000UTliAAG%27%29+AND+ParentId=%27%27";my $resp = await $client.get: $url, :http<1.1>, auth => { bearer => q[token] };say $resp'
[TRACE(anon 1)] RequestSerializerExtension EMIT Cro::HTTP::Request.new(body-parser-selector => Cro::HTTP::BodyParserSelector::RequestDefault, body-serializer-selector => Cro::HTTP::BodySerializerSelector::RequestDefault, connection => Any, method => "GET", target => "/services/data/v40.0/query/", http-version => Str, http2-stream-id => Int)
[TRACE(anon 1)] Cro::HTTP::RequestSerializer EMIT Cro::TCP::Message.new(data => Blob[uint8].new(71,69,84,32,47,115,101,114,118,105,99,101,115,47,100,97,116,97,47,118,52,48,46,48,47,113,117,101,114,121,47,32,72,84,84,80,47,49,46,49,13,10,72,111,115,116,58,32,99,115,56,53,46,115,97,108,101,115,102,111,114,99,101,46,99,111,109,13,10), connection => Any)
Note I've stripped the Auth header off the request trace as I don't see how it can be an issue.
GET /services/data/v40.0/query/ HTTP/1.1
Host: cs85.salesforce.com
So it looks like it's stripping off the query.
Cro::Uri.new(origin => "https://cs85.salesforce.com/services/data/v40.0/query/?q=SELECT+id,RecordTypeId,Name+FROM+Account+WHERE+RecordTypeId+IN+(012b0000000UTlhAAG,012b0000000UTlfAAG,012b0000000UTliAAG)+AND+ParentId=", scheme => "https", authority => "cs85.salesforce.com", userinfo => Str, host => "cs85.salesforce.com", host-class => Host::RegName, port => Int, path => "/services/data/v40.0/query/", query => "q=SELECT+id,RecordTypeId,Name+FROM+Account+WHERE+RecordTypeId+IN+(012b0000000UTlhAAG,012b0000000UTlfAAG,012b0000000UTliAAG)+AND+ParentId=", fragment => Str)
That's what I get when I run Cro::Uri.parse on the URL.
sub construct-url($path) {
my $pos = $parsed-url.Str.index('/', 8);
$parsed-url.Str.comb[0..$pos-1].join ~ $path;
}
Possibly that needs to be able to accept a query too? (I'm getting soo over my head in the code right now though).