Skip to content

Commit

Permalink
removed links method again from Mojo::Message
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 2, 2014
1 parent 373d29a commit b5c4de2
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 32 deletions.
1 change: 0 additions & 1 deletion Changes
@@ -1,6 +1,5 @@

5.24 2014-08-02
- Added links method to Mojo::Message.
- Improved split_header function in Mojo::Util to handle more formats with
an optional callback.
- Improved url_escape performance slightly.
Expand Down
19 changes: 0 additions & 19 deletions lib/Mojo/Message.pm
Expand Up @@ -139,12 +139,6 @@ sub json {
return $pointer ? Mojo::JSON::Pointer->new($data)->get($pointer) : $data;
}

sub links {
my $links = split_header shift->headers->link // '', \&_link;
my @links = map { {url => (splice @$_, 0, 2)[0], @$_} } @$links;
return {map { $_->{rel} => $_ } @links};
}

sub param { shift->body_params->param(@_) }

sub parse {
Expand Down Expand Up @@ -262,8 +256,6 @@ sub _limit {
return $self->error({message => $msg, advice => $code});
}

sub _link { ${$_[0]} =~ s/^\s*<(.+?)>// ? ($1, undef) : () }

sub _parse_formdata {
my ($self, $upload) = @_;

Expand Down Expand Up @@ -586,17 +578,6 @@ sure it is not excessively large, there's a 10MB limit by default.
say $msg->json->{foo}{bar}[23];
say $msg->json('/foo/bar/23');
=head2 links
my $links = $msg->links;
Extract web links from C<Link> header according to
L<RFC 5988|http://tools.ietf.org/html/rfc5988>.
# Extract information about next page
say $msg->links->{next}{url};
say $msg->links->{next}{title};
=head2 param
my @names = $msg->param;
Expand Down
12 changes: 0 additions & 12 deletions t/mojo/response.t
Expand Up @@ -416,8 +416,6 @@ is $res->headers->content_length, undef, 'right "Content-Length" value';
$res = Mojo::Message::Response->new;
$res->parse("HTTP/1.1 500 Internal Server Error\x0d\x0a");
$res->parse("Content-Type: text/plain\x0d\x0a");
$res->parse("Link: <http://example.com?foo=b;,ar>; rel=next\x0d\x0a");
$res->parse(qq{Link: </>; rel=root; title="foo bar"\x0d\x0a});
$res->parse("Transfer-Encoding: chunked\x0d\x0a\x0d\x0a");
$res->parse("4\x0d\x0a");
$res->parse("abcd\x0d\x0a");
Expand All @@ -432,14 +430,6 @@ is $res->headers->content_type, 'text/plain', 'right "Content-Type" value';
is $res->headers->content_length, 13, 'right "Content-Length" value';
is $res->headers->transfer_encoding, undef, 'no "Transfer-Encoding" value';
is $res->body_size, 13, 'right size';
is $res->headers->link,
'<http://example.com?foo=b;,ar>; rel=next, </>; rel=root; title="foo bar"',
'right "Link" value';
my $links = {
next => {url => 'http://example.com?foo=b;,ar', rel => 'next'},
root => {url => '/', rel => 'root', title => 'foo bar'}
};
is_deeply $res->links, $links, 'right links';

# Parse HTTP 1.1 multipart response
$res = Mojo::Message::Response->new;
Expand Down Expand Up @@ -473,8 +463,6 @@ isa_ok $res->content->parts->[1], 'Mojo::Content::Single', 'right part';
isa_ok $res->content->parts->[2], 'Mojo::Content::Single', 'right part';
is $res->content->parts->[0]->asset->slurp, "hallo welt test123\n",
'right content';
is $res->headers->link, undef, 'no "Link" value';
is_deeply $res->links, {}, 'no links';

# Parse HTTP 1.1 chunked multipart response (at once)
$res = Mojo::Message::Response->new;
Expand Down

0 comments on commit b5c4de2

Please sign in to comment.