Skip to content

Commit

Permalink
added content_location method to Mojo::Headers (closes #695)
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 24, 2014
1 parent 8379a27 commit db69bad
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,5 +1,6 @@

5.55 2014-10-24
- Added content_location method to Mojo::Headers.

5.54 2014-10-23
- Deprecated Object-Oriented Mojo::JSON API.
Expand Down
13 changes: 10 additions & 3 deletions lib/Mojo/Headers.pm
Expand Up @@ -9,9 +9,9 @@ has max_line_size => sub { $ENV{MOJO_MAX_LINE_SIZE} || 10240 };
my %NORMALCASE = map { lc($_) => $_ } (
qw(Accept Accept-Charset Accept-Encoding Accept-Language Accept-Ranges),
qw(Allow Authorization Cache-Control Connection Content-Disposition),
qw(Content-Encoding Content-Length Content-Range Content-Type Cookie DNT),
qw(Date ETag Expect Expires Host If-Modified-Since If-None-Match),
qw(Last-Modified Link Location Origin Proxy-Authenticate),
qw(Content-Encoding Content-Length Content-Location Content-Range),
qw(Content-Type Cookie DNT Date ETag Expect Expires Host If-Modified-Since),
qw(If-None-Match Last-Modified Link Location Origin Proxy-Authenticate),
qw(Proxy-Authorization Range Sec-WebSocket-Accept Sec-WebSocket-Extensions),
qw(Sec-WebSocket-Key Sec-WebSocket-Protocol Sec-WebSocket-Version Server),
qw(Set-Cookie Status TE Trailer Transfer-Encoding Upgrade User-Agent Vary),
Expand Down Expand Up @@ -302,6 +302,13 @@ Shortcut for the C<Content-Encoding> header.
Shortcut for the C<Content-Length> header.
=head2 content_location
my $location = $headers->content_location;
$headers = $headers->content_location('http://127.0.0.1/foo');
Shortcut for the C<Content-Location> header.
=head2 content_range
my $range = $headers->content_range;
Expand Down
1 change: 1 addition & 0 deletions t/mojo/headers.t
Expand Up @@ -58,6 +58,7 @@ is $headers->content_disposition('foo')->content_disposition, 'foo',
'right value';
is $headers->content_encoding('foo')->content_encoding, 'foo', 'right value';
is $headers->content_length('foo')->content_length, 'foo', 'right value';
is $headers->content_location('foo')->content_location, 'foo', 'right value';
is $headers->content_range('foo')->content_range, 'foo', 'right value';
is $headers->content_type('foo')->content_type, 'foo', 'right value';
is $headers->cookie('foo')->cookie, 'foo', 'right value';
Expand Down

0 comments on commit db69bad

Please sign in to comment.