update distar url
[catagits/Catalyst-Runtime.git] / t / more-psgi-compat.t
1 use warnings;
2 use strict;
3
4 use FindBin;
5 use Test::More;
6 use HTTP::Request::Common;
7
8 use lib "$FindBin::Bin/lib";
9 use Catalyst::Test 'TestFromPSGI';
10
11 {
12   ok my $response = request GET '/from_psgi_array',
13     'got welcome from a catalyst controller';
14
15   is $response->content, 'helloworldtoday',
16     'expected content body /from_psgi_array';
17 }
18
19 {
20   ok my $response = request GET '/from_psgi_code',
21     'got welcome from a catalyst controller';
22
23   is $response->content, 'helloworldtoday2',
24     'expected content body /from_psgi_code';
25 }
26
27 {
28   ok my $response = request GET '/from_psgi_code_itr',
29     'got welcome from a catalyst controller';
30
31   is $response->content, 'helloworldtoday3',
32     'expected content body /from_psgi_code_itr';
33 }
34
35 {
36   ok my($res, $c) = ctx_request(POST '/test_psgi_keys?a=1&b=2', [c=>3,d=>4]);
37
38   ok $c->req->env->{"psgix.input.buffered"}, "input is buffered";
39
40   is $c->req->parameters->get('c'), 3;
41   is $c->req->parameters->get('d'), 4;
42   is $c->req->parameters->get('a'), 1;
43   is $c->req->parameters->get('b'), 2;
44
45   is $c->req->body_parameters->get('c'), 3;
46   is $c->req->body_parameters->get('d'), 4;
47   is $c->req->query_parameters->get('a'), 1;
48   is $c->req->query_parameters->get('b'), 2;
49 }
50
51 done_testing;