-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Running Cro::HTTP 0.8.11 (though also reproduced on 0.8.10) on rakudo:
$ raku --version
Welcome to Rakudo™ v2024.06.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2024.06.
on Ubuntu:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal
This isn't the exactly code matching the CRO_TRACE dumps, but is very close, and I think I've actually reproduced it with this code, even though my HTTP/2 server (running on 9999) wasn't configured quite right.
#!/usr/bin/env raku
use v6;
use Cro::HTTP::Client;
sub MAIN () {
my $sr_key_yml = "SR: SR-whatever\n";
my @parts;
my $part = Cro::HTTP::Body::MultiPartFormData::Part.new(
name => 'file',
filename => "sr-key.yml",
body-blob => $sr_key_yml.encode('utf-8'),
headers => [Cro::HTTP::Header.new(name => 'Content-type', value => 'application/yaml')],
);
@parts.push($part);
my $multipart-body = Cro::HTTP::Body::MultiPartFormData.new(:@parts);
my $resp = await Cro::HTTP::Client.post: "http://localhost:9999/",
headers => [accept => 'application/json', X-Atlassian-Token => 'no-check'],
body => $multipart-body, http => 2;
}
The code I actually am concerned about doesn't select http => 2 as a parameter, but Cro::HTTP::Client does that automatically.
When I run that code I get something like this output from CRO_TRACE which returns a 415 from the server:
cro-client-http-2-multipart.txt
When I set http => 1.1 as an option, the server returns 200 and CRO_TRACE looks like:
Metadata
Metadata
Assignees
Labels
No labels