File: undef_encoding_regression.t

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (42 lines) | stat: -rw-r--r-- 883 bytes parent folder | download | duplicates (5)
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
32
33
34
35
36
37
38
39
40
41
42
use utf8;
use warnings;
use strict;
use Test::More;
use HTTP::Request::Common;
use HTTP::Message::PSGI ();
use Encode 2.21 'decode_utf8', 'encode_utf8', 'encode';

{
  package MyApp::Controller::Root;
  $INC{'MyApp/Controller/Root.pm'} = __FILE__;

  use base 'Catalyst::Controller';

  sub heart :Local Args(1) {
    my ($self, $c, $arg) = @_;

    Test::More::is $c->req->query_parameters->{a}, 111;
    Test::More::is $c->req->query_parameters->{b}, 222;
    Test::More::is $arg, 1;

    $c->response->content_type('text/html');
    $c->response->body("<p>This is path local</p>");
  }

  package MyApp;
  use Catalyst;

  MyApp->config(encoding => undef);

  Test::More::ok(MyApp->setup, 'setup app');
}

use Catalyst::Test 'MyApp';

{
  my $res = request "/root/heart/1?a=111&b=222";
  is $res->code, 200, 'OK';
  is $res->content, '<p>This is path local</p>';
}

done_testing;