NAME
Prancer::Response
SYNOPSIS
sub handler {
    my ($self, $env, $request, $response, $session) = @_;
    ...
    sub (GET) {
        $response->header("Content-Type" => "text/plain");
        $response->body("hello, goodbye");
        return $response->finalize(200);
    }
}
# or using a callback
sub handler {
    ...
    sub (GET) {
        $response->header("Content-Type" => "text/plain");
        $response->body(sub {
            my $writer = shift;
            $writer->write("What is up?");
            $writer->close();
        });
        return $response->finalize(200);
    }
}
METHODS
- header
 - 
This method expects a list of headers to add to the response. For example:
$response->header("Content-Type" => "text/plain"); $response->header("Content-Length" => 1234, "X-Foo" => "bar");If the header has already been set this will add another value to it and the response will include the same header multiple times. To replace a header that has already been set, remove the existing value first:
$response->headers->remove("X-Foo"); - headers
 - 
Returns a Hash::MultiValue of all headers that have been set to be sent with the response.
 - 
If called with no arguments this will return the names of all cookies that have been set to be sent with the response. Otherwise, this method expects a list of cookies to add to the response. For example:
$response->cookie("foo" => { 'value' => "test", 'path' => "/", 'domain' => ".example.com", 'expires' => time + 24 * 60 * 60, });The hashref may contain the keys
value,domain,expires,path,httponly, andsecure.expirescan take a string or an integer (as an epoch time) and does not convert string formats like+3M. - 
Returns a Hash::MultiValue of all cookies that have been set to be sent with the response.
 - body
 - 
Send buffered output to the client. Anything sent to the client with this method will be buffered until
finalizeis called. For example:$response->body("hello"); $response->body("goodbye", "world");If a buffered response is not desired then the body may be a callback to send a streaming response to the client. Any headers or response codes set in the callback will be ignored as they must all be set beforehand. Any body set before a callback is set will also be ignored. For example:
$response->body(sub { my $writer = shift; $writer->write("Hello, world!"); $writer->close(); return; }); - finalize
 - 
This requires one argument: the HTTP status code of the response. It will then send a PSGI compatible response to the client. For example:
# or hard code it $response->finalize(200);