Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hash order was changed in the last release #200

Merged
merged 4 commits into from May 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion META6.json
Expand Up @@ -44,7 +44,7 @@
"HTTP::UserAgent": "lib/HTTP/UserAgent.pm6",
"HTTP::UserAgent::Common": "lib/HTTP/UserAgent/Common.pm6"
},
"version": "1.1.40",
"version": "1.1.41",
"meta-version": "0",
"authors": [
"sergot"
Expand Down
2 changes: 1 addition & 1 deletion lib/HTTP/Header.pm6
Expand Up @@ -118,7 +118,7 @@ method clear() {

# get header as string
method Str($eol = "\n") {
@.fields.map({ "{$_.name}: {self.field($_.name)}$eol" }).flat.join;
@.fields.map({ "{$_.name}: {self.field($_.name)}$eol" }).flat.sort.join;
}

method parse($raw) {
Expand Down
4 changes: 2 additions & 2 deletions t/040-request.t
Expand Up @@ -50,7 +50,7 @@ lives-ok { $r1.set-method: 'PUT' }, "set method";
is $r1.method, 'PUT', 'set-method 1/1';

# parse
my $req = "GET /index HTTP/1.1\r\nHost: somesite\r\nAccept: test\r\n\r\nname=value&a=b\r\n";
my $req = "GET /index HTTP/1.1\r\nAccept: test\r\nHost: somesite\r\n\r\nname=value&a=b\r\n"; # Remember to use alphabetical order
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should require the CREATION order, not alphabetical order.

$r1 = HTTP::Request.new.parse($req);

is $r1.method, 'get'.uc, 'parse 1/6';
Expand All @@ -66,7 +66,7 @@ subtest {
is $r.method, 'GET', "right method";
is $r.file, '/bar', "right file";
is $r.field('Host'), 'foo.com', 'got right host';
}, "positional construcutor";
}, "positional constructor";

subtest {
subtest {
Expand Down