summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-07-20 03:40:00 -0500
committerJesse Luehrs <doy@tozt.net>2012-07-20 03:43:27 -0500
commit69b58eba5bc8a01e27c74d6d2346738fdf9f8eb5 (patch)
tree6b1b9ed4364259acab91e54194beb8db54ade5ab
parentd5eab12edd13a722b557dcaf4fc5866a12d736d6 (diff)
downloadweb-request-69b58eba5bc8a01e27c74d6d2346738fdf9f8eb5.tar.gz
web-request-69b58eba5bc8a01e27c74d6d2346738fdf9f8eb5.zip
rename ->body to ->content on ::Response
-rw-r--r--lib/Web/Response.pm10
-rw-r--r--t/path_info.t2
-rw-r--r--t/path_info_escaped.t2
-rw-r--r--t/response-body.t2
-rw-r--r--t/response-compatible.t10
-rw-r--r--t/response.t6
6 files changed, 16 insertions, 16 deletions
diff --git a/lib/Web/Response.pm b/lib/Web/Response.pm
index 513c981..5ee5387 100644
--- a/lib/Web/Response.pm
+++ b/lib/Web/Response.pm
@@ -45,7 +45,7 @@ has headers => (
},
);
-has body => (
+has content => (
is => 'rw',
isa => 'Web::Request::Types::PSGIBody',
lazy => 1,
@@ -88,7 +88,7 @@ sub finalize {
} $self->header($k);
} $self->headers->header_field_names
],
- $self->body
+ $self->content
];
}
@@ -173,7 +173,7 @@ The headers to return with the response. Can be provided as an arrayref, a
hashref, or an L<HTTP::Headers> object. Defaults to an L<HTTP::Headers> object
with no contents.
-=item body
+=item content
The content of the request. Can be provided as a string, an object which
overloads C<"">, an arrayref containing a list of either of those, a
@@ -221,9 +221,9 @@ Shortcut for C<< $ret->headers->content_encoding($encoding) >>.
Shortcut for C<< $ret->headers->header('Location', $location) >>.
-=method body($body)
+=method content($content)
-Sets (and returns) the C<body> attribute, as described above.
+Sets (and returns) the C<content> attribute, as described above.
=method cookies($cookies)
diff --git a/t/path_info.t b/t/path_info.t
index bab50b9..d5cbbcc 100644
--- a/t/path_info.t
+++ b/t/path_info.t
@@ -12,7 +12,7 @@ my $path_app = sub {
my $req = Web::Request->new_from_env(shift);
my $res = $req->new_response(status => 200);
$res->content_type('text/plain');
- $res->body($req->path_info);
+ $res->content($req->path_info);
return $res->finalize;
};
diff --git a/t/path_info_escaped.t b/t/path_info_escaped.t
index 28e712c..3bd4f62 100644
--- a/t/path_info_escaped.t
+++ b/t/path_info_escaped.t
@@ -12,7 +12,7 @@ my $path_app = sub {
my $req = Web::Request->new_from_env(shift);
my $res = $req->new_response(status => 200);
$res->content_type('text/plain');
- $res->body('my ' . Dumper([ $req->uri, $req->parameters ]));
+ $res->content('my ' . Dumper([ $req->uri, $req->parameters ]));
return $res->finalize;
};
diff --git a/t/response-body.t b/t/response-body.t
index 39e2e03..80056fe 100644
--- a/t/response-body.t
+++ b/t/response-body.t
@@ -10,7 +10,7 @@ use Web::Response;
sub r($) {
my $res = Web::Response->new(status => 200);
- $res->body(@_);
+ $res->content(@_);
return $res->finalize->[2];
}
diff --git a/t/response-compatible.t b/t/response-compatible.t
index 9fa8e54..daf2c54 100644
--- a/t/response-compatible.t
+++ b/t/response-compatible.t
@@ -9,7 +9,7 @@ use Web::Response;
my $res = Web::Response->new;
$res->status(200);
$res->header("Foo:Bar" => "baz");
- $res->body("Hello");
+ $res->content("Hello");
is_deeply $res->finalize, [ 200, [ 'Foo:Bar' => 'baz' ], ["Hello"] ];
}
@@ -19,7 +19,7 @@ use Web::Response;
$res->status(200);
$res->header("Foo\000Bar" => "baz");
$res->header("Qux\177Quux" => "42");
- $res->body("Hello");
+ $res->content("Hello");
is_deeply $res->finalize, [ 200, [ "Foo\000Bar" => 'baz', "Qux\177Quux" => '42' ], ["Hello"] ];
}
@@ -29,7 +29,7 @@ use Web::Response;
$res->status(200);
$res->header("X-LWS-I" => "Bar\r\n true");
$res->header("X-LWS-II" => "Bar\r\n\t\ttrue");
- $res->body("Hello");
+ $res->content("Hello");
is_deeply $res->finalize,
[
@@ -43,7 +43,7 @@ use Web::Response;
my $res = Web::Response->new;
$res->status(200);
$res->header("X-CR-LF" => "Foo\nBar\rBaz");
- $res->body("Hello");
+ $res->content("Hello");
is_deeply $res->finalize, [ 200, [ 'X-CR-LF' => 'FooBarBaz' ], ["Hello"] ];
}
@@ -52,7 +52,7 @@ use Web::Response;
my $res = Web::Response->new;
$res->status(200);
$res->header("X-CR-LF" => "Foo\nBar\rBaz");
- $res->body("Hello");
+ $res->content("Hello");
is_deeply $res->finalize, [ 200, [ 'X-CR-LF' => 'FooBarBaz' ], ["Hello"] ];
}
diff --git a/t/response.t b/t/response.t
index a189c4d..eedf540 100644
--- a/t/response.t
+++ b/t/response.t
@@ -16,8 +16,8 @@ sub res {
is_deeply(
res(
- status => 200,
- body => 'hello',
+ status => 200,
+ content => 'hello',
),
[ 200, +[], [ 'hello' ] ]
);
@@ -38,7 +38,7 @@ is_deeply(
path => '/',
},
},
- body => 'hello',
+ content => 'hello',
),
[
200,