File: 05_api.t

package info (click to toggle)
libdancer-perl 1.3521%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,460 kB
  • sloc: perl: 7,436; xml: 2,211; sh: 54; makefile: 32; sql: 5
file content (31 lines) | stat: -rw-r--r-- 668 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use strict;
use warnings;

use Test::More;
use Dancer::Response;

plan tests => 10;

ok my $response = Dancer::Response->new();
is $response->status, 200;

isa_ok $response->{headers}, 'HTTP::Headers';

$response->header('Content-Type' => 'text/html');
is $response->header('Content-Type'), 'text/html';

$response->status(500);
is $response->status, 500;

$response->content("this is my content");
is $response->content, "this is my content";

ok $response->exists;

$response->pass(1);
ok $response->has_passed;
$response->pass(0);
ok !$response->has_passed;

my $psgi_headers = $response->headers_to_array();
is_deeply $psgi_headers, ['Content-Type', 'text/html'];