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

Added more POD to Dancer::Request and Dancer::Response #995

Closed
wants to merge 2 commits into from
Closed
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
8 changes: 8 additions & 0 deletions lib/Dancer/Request.pm
Expand Up @@ -665,6 +665,10 @@ parameters to be added to the current request parameters, and the key
C<options> that points to a hash of options about the redirect (for
instance, C<method> pointing to a new request method).

=head2 is_forward

Flag that will be set to true if the request has been L<forwarded|forward>.

=head2 to_string()

Return a string representing the request object (eg: C<"GET /some/path">)
Expand Down Expand Up @@ -839,6 +843,10 @@ Return the value of the given header, if present. If the header has multiple
values, returns an the list of values if called in list context, the first one
in scalar.

=head2 headers()

Returns the L<HTTP::Header> object used to store all the headers.

=head2 body()

Return the raw body of the request, unparsed.
Expand Down
20 changes: 12 additions & 8 deletions lib/Dancer/Response.pm
Expand Up @@ -256,7 +256,7 @@ set or get the content of the current response object
$response->status(201);
Dancer::SharedData->response->status(201);

set or get the status of the current response object
Set or get the status of the current response object. The default status is 200.

=head2 content_type

Expand All @@ -268,14 +268,14 @@ set or get the status of the current response object
$response->content_type('application/json');
Dancer::SharedData->response->content_type('application/json');

set or get the status of the current response object
Set or get the status of the current response object.

=head2 pass

$response->pass;
Dancer::SharedData->response->pass;

set the pass value to one for this response
Set the pass value to one for this response.

=head2 has_passed

Expand All @@ -287,13 +287,15 @@ set the pass value to one for this response
...
}

test if the pass value is set to true
Test if the pass value is set to true.

=head2 halt
=head2 halt($content)

Dancer::SharedData->response->halt();
$response->halt;

Stops the processing of the current request. See L<Dancer/halt>.

=head2 halted

if (Dancer::SharedData->response->halted) {
Expand All @@ -304,6 +306,8 @@ test if the pass value is set to true
...
}

This flag will be true if the current response has been halted.

=head2 header

# set the header
Expand All @@ -314,20 +318,20 @@ test if the pass value is set to true
my $header = $response->header('X-Foo');
my $header = Dancer::SharedData->response->header('X-Foo');

get or set the value of a header
Get or set the value of a header.

=head2 headers

$response->headers('X-Foo' => 'fff', 'X-Bar' => 'bbb');
Dancer::SharedData->response->headers('X-Foo' => 'fff', 'X-Bar' => 'bbb');

return the list of headers for the current response
Return the list of headers for the current response.

=head2 headers_to_array

my $headers_psgi = $response->headers_to_array();
my $headers_psgi = Dancer::SharedData->response->headers_to_array();

this method is called before returning a L<< PSGI >> response. It transforms the list of headers to an array reference.
This method is called before returning a L<< PSGI >> response. It transforms the list of headers to an array reference.