23 |
use File::Path qw(make_path remove_tree); |
use File::Path qw(make_path remove_tree); |
24 |
use Storable; |
use Storable; |
25 |
|
|
26 |
our $VERSION = '0.1'; |
our $VERSION = '0.2'; |
27 |
$VERSION .= ' on Frey ' . $Frey::VERSION; |
$VERSION .= " (Frey $Frey::VERSION)" if $Frey::VERSION; |
28 |
|
|
29 |
our $debug = $Frey::debug || 0; |
our $debug = $Frey::debug || 0; |
30 |
|
|
275 |
} |
} |
276 |
|
|
277 |
$tx->res->code( $status ); |
$tx->res->code( $status ); |
278 |
$tx->res->headers->content_type( 'text/json' ); |
$tx->res->headers->content_type( 'text/plain;charset=utf-8' ); |
279 |
my $body = to_json $json; |
my $body = to_json $json; |
280 |
$tx->res->body( $body ); |
$tx->res->body( $body ); |
281 |
warn "CouchDB API: $method $url $status $body\n"; |
$tx->res->headers->add_line( 'Cache-Control' => 'must-revalidate' ); |
282 |
|
$tx->res->headers->add_line( 'Server' => "Frey::CouchAPI/$VERSION" ); |
283 |
|
|
284 |
|
warn "INFO CouchDB API $method $url $status\n$body\n"; |
285 |
|
|
286 |
warn "## headers ", $tx->res->headers->to_string; |
warn "## headers ", $tx->res->headers->to_string; |
287 |
|
|