Result:
found more than 950 distributions - search limited to the first 2001 files matching your query ( run in 1.334 )


Daemonise

 view release on metacpan or  search on metacpan

lib/Daemonise/Plugin/HipChat.pm  view on Meta::CPAN

            notify         => $notify_users   || 0,
            color          => $colour,
        });

    unless ($res->is_success) {
        $self->log($res->status_line . ': ' . $res->decoded_content);
    }

    # exit; # async
    return;
};

 view all matches for this distribution


Daizu

 view release on metacpan or  search on metacpan

lib/Daizu/Feed.pm  view on Meta::CPAN

    if ($format eq 'atom') {    # Atom 1.0
        $feed = $doc->createElementNS($ATOM_NS, 'feed');
        $entry_parent = $feed;

        add_xml_elem($feed, title => $feed_title);
        # TODO - description should be decoded from utf-8 at some point
        add_xml_elem($feed, subtitle => $file->{description})
            if defined $file->{description};
        add_xml_elem($feed, id => $file->guid_uri);
        add_xml_elem($feed, generator => 'Daizu CMS',
            uri => 'http://www.daizucms.org/',

 view all matches for this distribution


Daje-Plugin-Tools

 view release on metacpan or  search on metacpan

_Deparsed_XSubs.pm  view on Meta::CPAN

sub setlocale($;$) ;
}
package MIME::Base64 {
sub decode($) ;
sub decode_base64($) ;
sub decoded_base64_length($) ;
sub encode($;$) ;
sub encode_base64($;$) ;
sub encoded_base64_length($;$) ;
}
package MIME::Charset {

 view all matches for this distribution


Dancer-Plugin-Auth-Github

 view release on metacpan or  search on metacpan

lib/Dancer/Plugin/Auth/Github.pm  view on Meta::CPAN

		state                      => $state_received
		]);
		die "error while fetching: ", $resp->status_line
		unless $resp->is_success;
		
		my %querystr = parse_query_str($resp->decoded_content);
		my $acc = $querystr{access_token};
		
		if($acc) {
			my $jresp  = $browser->get("https://api.github.com/user?access_token=$acc");
			my $json = decode_json($jresp->decoded_content);
			session 'github_user' => $json;
			session 'github_access_token' => $acc;
			#session 'logged_in' => true;
			redirect $github_auth_success;
			return;

 view all matches for this distribution


Dancer-Plugin-Auth-Google

 view release on metacpan or  search on metacpan

lib/Dancer/Plugin/Auth/Google.pm  view on Meta::CPAN

            redirect_uri  => $callback_url,
            grant_type    => 'authorization_code',
        }
    );

    my ($data, $error) = _parse_response( $res->decoded_content );
    if (ref $data && !$error) {
        # Google tells us to ignore any unrecognized fields
        # included in the response (like their "id_token").
        $data = {
            access_token  => $data->{access_token},

lib/Dancer/Plugin/Auth/Google.pm  view on Meta::CPAN

        'https://www.googleapis.com/oauth2/v2/userinfo',
        [ 'Authorization' => 'Bearer ' . $data->{access_token} ],
    );

    my $user;
    ($user, $error)  = _parse_response( $res->decoded_content );
    return send_error("google auth: $error") if $error;

    if (exists $user->{verified_email}) {
        # we stringify our JSON::Bool data as some session
        # backends might have trouble storing objects.

 view all matches for this distribution


Dancer-Plugin-DynamicConfig

 view release on metacpan or  search on metacpan

lib/Dancer/Plugin/DynamicConfig.pm  view on Meta::CPAN

the data, and only re-read it when the file's mtime has changed.

=head2 The rewrite_class

This class, if provided, must implement one class method, C<rewrite()>, which
takes the decoded data structure represented by the file's contents.
C<rewrite()> may then return any data structure it likes, and this structure
will be passed back as the return value of C<dynamic_config()>.

=head2 Filetypes

 view all matches for this distribution


Dancer-Plugin-EncodeID

 view release on metacpan or  search on metacpan

lib/Dancer/Plugin/EncodeID.pm  view on Meta::CPAN

		#print STDERR "Decoded: '$text'\n";
		$cleartext .= $text;
	};

	if (defined $prefix) {
		## Ensure the decoded ID contains the prefix
		my $i = index $cleartext,$prefix;
		if ($i != 0) {
			die "Invalid Hash-ID value ($orig_encoded_id) - bad prefix" ;
		}
		#skip the prefix;

lib/Dancer/Plugin/EncodeID.pm  view on Meta::CPAN


=head1 FUNCTIONS

C<encode_id(ID [,PREFIX])> - Encodes the given ID, returns the encoded hash value.
			     If "PREFIX" is given, it will be added to the ID before encoding.
			     It can be used when decoding to verify the decoded value is valid.

C<decode_id(ID [,PREFIX])> - Decodes the given ID, returns the original (cleartext) ID value.
			     If "PREFIX" is given, it will be used to verify the validity of the ID.

=head1 DESCRIPTION

 view all matches for this distribution


Dancer-Plugin-SimpleLexicon

 view release on metacpan or  search on metacpan

lib/Dancer/Plugin/SimpleLexicon.pm  view on Meta::CPAN

The value of the default language. If not specified, and the looking up
in the above values fails, no translation will be done.

=head2 encoding

The string returned by maketext will be decoded using
this encoding. By default is C<UTF-8>.

To disable the decoding, set it to C<raw>.

=head1 EXPORT

 view all matches for this distribution


Dancer-SearchApp

 view release on metacpan or  search on metacpan

lib/CORION/Apache/Tika/Connection/LWP.pm  view on Meta::CPAN

    my $p = deferred;
    my ( $code, $response ) = $self->process_response(
        $res->request,                      # request
        $res->code,    # code
        $res->message,    # msg
        $res->decoded_content,                        # body
        $res->headers                      # headers
    );
    $p->resolve( $code, $response );
    
    $p->promise

 view all matches for this distribution


Dancer

 view release on metacpan or  search on metacpan

lib/Dancer/Request.pm  view on Meta::CPAN


    $new_request->{params}  = $new_params;
    $new_request->{_body_params}  = $request->{_body_params};
    $new_request->{_query_params} = $request->{_query_params};
    $new_request->{_route_params} = $request->{_route_params};
    $new_request->{_params_are_decoded} = 1;
    $new_request->{headers} = $request->headers;

    if( my $session = Dancer::Session->engine 
                      && Dancer::Session->get_current_session ) {
        my $name = $session->session_name;

lib/Dancer/Request.pm  view on Meta::CPAN

sub params {
    my ($self, $source) = @_;

    my @caller = caller;

    if (not $self->{_params_are_decoded}) {
        $self->{params}        = _decode($self->{params});
        $self->{_body_params}  = _decode($self->{_body_params});
        $self->{_query_params} = _decode($self->{_query_params});
        $self->{_route_params} = _decode($self->{_route_params});
        $self->{_params_are_decoded} = 1;
    }

    return %{$self->{params}} if wantarray && @_ == 1;
    return $self->{params} if @_ == 1;

lib/Dancer/Request.pm  view on Meta::CPAN


An alias to request_uri()

=head2 request_uri()

Return the raw, undecoded request URI path.

=head2 user()

Return remote user if defined.

 view all matches for this distribution


Dancer2-Plugin-Auth-OAuth

 view release on metacpan or  search on metacpan

lib/Dancer2/Plugin/Auth/OAuth/Provider/AzureAD.pm  view on Meta::CPAN

      Accept => "application/json"
    );

    if ( $resp->is_success ) {
      my $user = $self->_stringify_json_booleans(
        JSON::MaybeXS::decode_json( $resp->decoded_content )
      );
      $session_data->{azuread}{user_info} = $user;
    } else {
      # To-Do: logging error
    }

lib/Dancer2/Plugin/Auth/OAuth/Provider/AzureAD.pm  view on Meta::CPAN

After login, the following session key will have contents: C<{oauth}{azuread}>

The token will probably be in C<{id_token}>

When log in has occured, the provider attempts to decode the resulting token
for information about the user. All of the decoded information can be found in
the session key: C<{oauth}{azuread}{login_info}>

The login email address, for example, will probably be in a key called
C<{unique_name}>

 view all matches for this distribution


Dancer2-Plugin-ElasticSearch

 view release on metacpan or  search on metacpan

t/000-base.t  view on Meta::CPAN


my $test = Plack::Test->create(TestApp->to_app);

my $is_client_ok = $test->request(GET '/client_status');

unless ($is_client_ok->decoded_content eq 'available') {
    # couldn't call "elastic", assume no local ES cluster
    plan 'skip_all', 'ElasticSearch client not instantiable: ' . $is_client_ok->decoded_content;
}

my $count_response = $test->request(GET '/count');

ok($count_response->is_success, '... and we can talk to the ES instance');

my $count = from_json($count_response->decoded_content);
ok(exists $count->{hits},
   q{... and the response looks like an ES response});

my $ref1 = $test->request(GET '/client_refname')->decoded_content;
my $ref2 = $test->request(GET '/client_refname')->decoded_content;
is($ref1, $ref2,
   qq{... and both calls to elastic() return the same object ($ref1)});

done_testing;

 view all matches for this distribution


Dancer2-Plugin-EncryptID

 view release on metacpan or  search on metacpan

lib/Dancer2/Plugin/EncryptID.pm  view on Meta::CPAN


=head2 dancer_encrypt

C<dancer_encrypt(ID [,PREFIX])> - Encrypt the given ID, returns the encoded hash value.
			     If "PREFIX" is given, it will be added to the ID before encoding.
			     It can be used when decoding to verify the decoded value is valid.

=cut

plugin_keywords 'dancer_encrypt';

 view all matches for this distribution


Dancer2-Plugin-Feed

 view release on metacpan or  search on metacpan

t/01-basic.t  view on Meta::CPAN

for my $format (qw/atom rss/) {
    for my $route ("/feed/$format", "/other/feed/$format") {
        ok ($res = $psgi->request( GET $route ) );
        is $res->code, 200, "$format - $route";
        is ($res->header('Content-Type'), "application/$format+xml");
        ok ( $feed = XML::Feed->parse( \$res->decoded_content ) );
        is ( $feed->title, 'TestApp with ' . $format );
        my @entries = $feed->entries;
        is (scalar @entries, 10);
        is ($entries[0]->title, 'entry 1');
    }

 view all matches for this distribution


Dancer2-Plugin-GraphQL

 view release on metacpan or  search on metacpan

t/ajax.t  view on Meta::CPAN

    POST '/graphql',
      Content_Type => 'application/json',
      Content => '{"query":"{helloWorld}"}',
  );
  my $json = JSON::MaybeXS->new->allow_nonref;
  is_deeply eval { $json->decode( $res->decoded_content ) },
    { 'data' => { 'helloWorld' => 'Hello, world!' } },
    'Content as expected';
};

subtest 'GraphQL with route-handler' => sub {

t/ajax.t  view on Meta::CPAN

    POST '/graphql2',
      Content_Type => 'application/json',
      Content => '{"query":"{helloWorld}"}',
  );
  my $json = JSON::MaybeXS->new->allow_nonref;
  is_deeply eval { $json->decode( $res->decoded_content ) },
    { 'data' => { 'helloWorld' => 'Hello, world!' } },
    'Content as expected';
};

subtest 'GraphQL with die' => sub {

t/ajax.t  view on Meta::CPAN

    POST '/graphql-live-and-let-die',
      Content_Type => 'application/json',
      Content => '{"query":"{helloWorld}"}',
  );
  my $json = JSON::MaybeXS->new->allow_nonref;
  is_deeply eval { $json->decode( $res->decoded_content ) },
    { errors => [ { message => "I died!\n" } ] },
    'error as expected';
};

subtest 'GraphiQL' => sub {
  my $res = $test->request(
    GET '/graphql',
      Accept => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  );
  like $res->decoded_content, qr/React.createElement\(GraphiQL/, 'Content as expected';
};

done_testing;

 view all matches for this distribution


Dancer2-Plugin-JWT

 view release on metacpan or  search on metacpan

lib/Dancer2/Plugin/JWT.pm  view on Meta::CPAN

                elsif ($app->request->param('_jwt')) {
                    $encoded = $app->request->param('_jwt');
                }

                if ($encoded) {
                    my $decoded;
                    eval {
                        $decoded = decode_jwt( token        => $encoded,
                                               key          => $secret,
                                               verify_iat   => $need_iat,
                                               verify_nbf   => $need_nbf,
                                               verify_exp   => defined $need_exp ? 1 : 0 ,
                                               leeway       => $need_leeway,

lib/Dancer2/Plugin/JWT.pm  view on Meta::CPAN

                                               accepted_enc => $enc );
                    };
                    if ($@) {
                        $app->execute_hook('plugin.jwt.jwt_exception' => ($a = $@));  # this is weird, but required!
                    };
                    $app->request->var('jwt', $decoded);
                    $app->request->var('jwt_status' => 'present');

                }
                else {
                    ## no token

lib/Dancer2/Plugin/JWT.pm  view on Meta::CPAN

    $dsl->app->add_hook(
        Dancer2::Core::Hook->new(
            name => 'after',
            code => sub {
                my $response = shift;
                my $decoded = $dsl->app->request->var('jwt');
                if($set_authorization_header || $set_cookie_header || $set_location_header) {
                    # If all are disabled, then skip also encoding!
                    if (defined($decoded)) {
                        my $encoded = encode_jwt( payload      => $decoded,
                                                  key          => $secret,
                                                  alg          => $alg,
                                                  enc          => $enc,
                                                  auto_iat     => $need_iat,
                                                  relative_exp => $need_exp,

 view all matches for this distribution


Dancer2-Plugin-LiteBlog

 view release on metacpan or  search on metacpan

lib/Dancer2/Plugin/LiteBlog/Scaffolder.pm  view on Meta::CPAN

    my ($base64_content, $output_path) = @_;

    # Decode the base64 string
    my $binary_data = decode_base64($base64_content);

    # Write the decoded binary data to a file
    write_file($output_path, {binmode => ':raw'}, $binary_data);
}

sub scaffold {
    my ($basedir, $force) = @_;

 view all matches for this distribution


Dancer2-Plugin-OAuth2-Server

 view release on metacpan or  search on metacpan

t/custom.t  view on Meta::CPAN

my $code = $uri->query_param( 'code' );

$request  = POST '/access_token', Content => [ client_id => 'client1', client_secret => 'secret', grant_type => 'authorization_code', code => $code, redirect_uri => 'http://localhost/callback' ];
$response = $test->request($request);
is $response->code, 200, "Access token route working";
my $decoded = from_json( $response->content );
ok exists $decoded->{access_token}, "Access token provided";
ok exists $decoded->{refresh_token}, "Refresh token provided";
my $access_token = $decoded->{access_token};
my $refresh_token = $decoded->{refresh_token};

$request  = HTTP::Request->new( GET => '/protected-identity' );
$request->header( Authorization => "Bearer $access_token");
$response = $test->request($request);
is $response->code, 200, "With bearer, protected route OK";

t/custom.t  view on Meta::CPAN

is $response->code, 400, "With bearer, protected route with another scope KO";

$request  = POST '/access_token', Content => [ client_id => 'client1', client_secret => 'secret', grant_type => 'refresh_token', refresh_token => $refresh_token ];
$response = $test->request($request);
is $response->code, 200, "Refresh access token succesfully";
$decoded = from_json( $response->content );
ok exists $decoded->{access_token}, "Access token provided";
ok exists $decoded->{refresh_token}, "Refresh token provided";
my $new_access_token = $decoded->{access_token};
my $new_refresh_token = $decoded->{refresh_token};
isnt $new_access_token, $access_token, "Access token has changed";
isnt $new_refresh_token, $refresh_token, "Refresh token has changed";
#ok exists $decoded->{access_token}, "Access token provided";

$request  = HTTP::Request->new( GET => '/protected-identity' );
$request->header( Authorization => "Bearer $new_access_token");
$response = $test->request($request);
is $response->code, 200, "With bearer, new access token, protected route OK";

t/custom.t  view on Meta::CPAN

my $code = $uri->query_param( 'code' );

$request  = POST '/access_token', Content => [ client_id => 'client2', client_secret => 'secret2', grant_type => 'authorization_code', code => $code, redirect_uri => 'http://localhost/callback' ];
$response = $test->request($request);
is $response->code, 200, "Access token route working";
my $decoded = from_json( $response->content );
ok exists $decoded->{access_token}, "Access token provided";
ok exists $decoded->{refresh_token}, "Refresh token provided";
my $access_token = $decoded->{access_token};
my $refresh_token = $decoded->{refresh_token};

$request  = HTTP::Request->new( GET => '/protected-identity' );
$request->header( Authorization => "Bearer $access_token");
$response = $test->request($request);
is $response->code, 200, "With bearer, protected route OK";

t/custom.t  view on Meta::CPAN

my $code = $uri->query_param( 'code' );

$request  = POST '/access_token', Content => [ client_id => 'client2', client_secret => 'secret2', grant_type => 'authorization_code', code => $code, redirect_uri => 'http://localhost/callback' ];
$response = $test->request($request);
is $response->code, 200, "Access token route working";
my $decoded = from_json( $response->content );
ok exists $decoded->{access_token}, "Access token provided";
ok exists $decoded->{refresh_token}, "Refresh token provided";
my $access_token = $decoded->{access_token};
my $refresh_token = $decoded->{refresh_token};

$request  = HTTP::Request->new( GET => '/protected-identity' );
$request->header( Authorization => "Bearer $access_token");
$response = $test->request($request);
is $response->code, 200, "With bearer, protected route OK";

t/custom.t  view on Meta::CPAN

my $code = $uri->query_param( 'code' );

$request  = POST '/access_token', Content => [ client_id => 'client2', client_secret => 'secret2', grant_type => 'authorization_code', code => $code, redirect_uri => 'http://localhost/callback' ];
$response = $test->request($request);
is $response->code, 200, "Access token route working";
my $decoded = from_json( $response->content );
ok exists $decoded->{access_token}, "Access token provided";
ok exists $decoded->{refresh_token}, "Refresh token provided";

#try to use the same code a second time
$response = $test->request($request);
is $response->code, 400, "Access token route not working, authorization code already consumed";
my $decoded = from_json( $response->content );
ok !exists $decoded->{access_token}, "Access token not provided";
ok !exists $decoded->{refresh_token}, "Refresh token not provided";

#Wrong scope
my $uri = URI->new( '/authorize' );
$uri->query_param( client_id => 'client1' );
$uri->query_param( redirect_uri => 'http://localhost/callback' );

 view all matches for this distribution


Dancer2-Plugin-OpenTelemetry

 view release on metacpan or  search on metacpan

t/basic.t  view on Meta::CPAN


my $test = Plack::Test->create( Local::App->to_app );

subtest 'Static URL' => sub {
    is $test->request( GET '/static/url?query=parameter' ), object {
        call decoded_content => 'OK';
    }, 'Request OK';

    is $span->{otel}, {
        attributes => {
            'client.address'           => '127.0.0.1',

t/basic.t  view on Meta::CPAN

    ], 'Expected calls on span';
};

subtest 'Forward' => sub {
    is $test->request( GET '/forward' ), object {
        call decoded_content => 'OK';
    }, 'Request OK';

    is $span->{otel}, {
        attributes => {
            'client.address'           => '127.0.0.1',

t/basic.t  view on Meta::CPAN

    ], 'Expected calls on span';
};

subtest 'Pass' => sub {
    is $test->request( GET '/url/with/pass' ), object {
        call decoded_content => 'OK';
    }, 'Request OK';

    is $span->{otel}, {
        attributes => {
            'client.address'           => '127.0.0.1',

t/basic.t  view on Meta::CPAN

subtest 'Async' => sub {
    require Test2::Require::Module;
    Test2::Require::Module->import('IO::Async');

    is $test->request( GET '/async', user_agent => 'Test' ), object {
        call decoded_content => 'OK';
    }, 'Request OK';

    is $span->{otel}, {
        attributes => {
            'client.address'           => '127.0.0.1',

t/basic.t  view on Meta::CPAN

    ], 'Expected calls on span';
};

subtest 'With placeholder' => sub {
    is $test->request( GET '/url/with/value' ), object {
        call decoded_content => 'OK';
    }, 'Request OK';

    is $span->{otel}, {
        attributes => {
            'client.address'           => '127.0.0.1',

t/basic.t  view on Meta::CPAN

};

subtest 'Response code' => sub {
    is $test->request( GET '/status/400' ), object {
        call code            => 400;
        call decoded_content => 'OK';
    }, 'Request OK';

    is $span->{otel}, {
        attributes => {
            'client.address'           => '127.0.0.1',

 view all matches for this distribution


Dancer2-Plugin-ParamKeywords

 view release on metacpan or  search on metacpan

t/plugin.t  view on Meta::CPAN

subtest 'Route param' => sub {
    my $res = $test->request(
        POST '/route/foo?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'foo', 'Route returns foo' );
};

subtest 'Query param' => sub {
    my $res = $test->request(
        POST '/query/foo?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'bar', 'Query returns bar' );
};

subtest 'Body param' => sub {
    my $res = $test->request(
        POST '/body/foo?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'baz', 'Body returns baz' );
};

subtest 'All params' => sub {
    my $res = $test->request(
        POST '/params/foo?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'foo bar baz', 'All params returns foo bar baz' );
};

subtest 'Munged params route' => sub {
    my $res = $test->request(
        POST '/munged/foo?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'foo', 'Munge honors route' );
};

subtest 'Munged params query' => sub {
    my $res = $test->request(
        POST '/munged?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'bar', 'Munge honors query' );
};

subtest 'Munged params body' => sub {
    my $res = $test->request(
        POST '/munged', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'baz', 'Munge honors body' );
};

subtest 'Munged param route' => sub {
    my $res = $test->request(
        POST '/munged_singular/foo?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'foo', 'Munge singular honors route' );
};

subtest 'Munged param query' => sub {
    my $res = $test->request(
        POST '/munged_singular?param=bar', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'bar', 'Munge singular honors query' );
};

subtest 'Munged param body' => sub {
    my $res = $test->request(
        POST '/munged_singular', Content => [ param => 'baz' ]
    );

    is( $res->decoded_content, 'baz', 'Munge singular honors body' );
};


done_testing;

 view all matches for this distribution


Dancer2-Plugin-ProgressStatus

 view release on metacpan or  search on metacpan

t/test-progress.t  view on Meta::CPAN

    ok( $response1->is_success, 'Response ok when setting and updating progress' );

    my $response2 = $app->request( GET '/_progress_status/test' );
    ok($response2->is_success, 'Get good response from progressstatus');

    my $data = $json->decode($response2->decoded_content);
    is($data->{total}, 100, 'Total is 100');
    is($data->{count}, 2, 'Count matches total');
    ok(!$data->{in_progress}, 'No longer in progress');
}

t/test-progress.t  view on Meta::CPAN

{
    my $response1 = $app->request( GET '/test_progress_status_with_args' );
    ok( $response1->is_success, 'Success for less simple progress' );

    my $response2 = $app->request( GET '/_progress_status/test2' );
    my $data = $json->decode($response2->decoded_content);
    is($data->{total}, 200, 'Total is 200');
    is($data->{count}, 3, 'Count matches total');
    is(scalar(@{$data->{messages}}), 2, 'Has two messages');
    ok(!$data->{in_progress}, 'No longer in progress');
}

t/test-progress.t  view on Meta::CPAN

    ok($response1->is_success, 'Two progress meters with the same name and same pid pass');
    like($response1->content, qr/^Progress status test3 already exists/,
        'two unfinished progress meters with the same name dies');

    my $response2 = $app->request( GET '/_progress_status/test3' );
    my $data = $json->decode($response2->decoded_content);
    is($data->{total}, 200, 'Total is overriden');
}

{
    ## Test progress status with automatic ID
    my $response1 = $app->request(GET '/test_progress_with_progress_id?progress_id=1000');
    ok($response1->is_success, '200 response for progress with progress id');

    my $response2 = $app->request(GET '/_progress_status/1000');
    ok($response2->is_success, 'Get good response from progressstatus');
    my $data = $json->decode($response2->decoded_content);
    is($data->{total}, 100, 'Get a sensible response');
}


done_testing(17); # number of tests + Test::Warnings

 view all matches for this distribution


Dancer2-Plugin-RPC

 view release on metacpan or  search on metacpan

t/100-xmlrpc.t  view on Meta::CPAN

<params/>
</methodCall>
        EOXML
    );
    my $response = $tester->request($request);
    my $value = $p->parse($response->decoded_content)->value->value;
    is_deeply(
        $value,
        'pong',
        "ping"
    ) or diag(explain($value));

t/100-xmlrpc.t  view on Meta::CPAN

        EOXML
    );
    my $response = $tester->request($request);
    is($response->status_line, '200 OK', "OK response");

    my $methods = $p->parse($response->decoded_content)->value->value;
    is_deeply(
        $methods,
        {
            '/endpoint' => [qw/
                methodList

 view all matches for this distribution


Dancer2-Plugin-Redis

 view release on metacpan or  search on metacpan

t/Util.pm  view on Meta::CPAN

    my $req = HTTP::Request->new( $method => "http://localhost$uri" );
    my $res = $cb->($req);
    subtest "$method $uri" => sub {
      plan tests => $expected_response ? 2 : 1;
      ok( $res->is_success, "request successful for $method $uri" );
      like( $res->decoded_content, $expected_response, "expected response content for $method $uri" )
        if $expected_response;
    };
    return;
  };
  test_psgi( $app, $client );

 view all matches for this distribution


Dancer2-Plugin-WebSocket

 view release on metacpan or  search on metacpan

lib/Dancer2/Plugin/WebSocket.pm  view on Meta::CPAN

=over

=item serializer

If serializer is set to a C<true> value, messages will be assumed to be JSON
objects and will be automatically encoded/decoded using a L<JSON::MaybeXS>
serializer.  If the value of C<serializer> is a hash, it'll be passed as
arguments to the L<JSON::MaybeXS> constructor.

    plugins:
        WebSocket:

 view all matches for this distribution


Dancer2-Serializer-JSONMaybeXS

 view release on metacpan or  search on metacpan

t/deserialize.t  view on Meta::CPAN

    };
}

note "Decoding of mixed route and deserialized body params"; {
    # Check integers from request body remain integers
    # but route params get decoded.
    test_psgi $app, sub {
        my $cb = shift;

        my @req_params = (
            "/from/D\x{c3}\x{bc}sseldorf", # /from/d%C3%BCsseldorf

t/deserialize.t  view on Meta::CPAN


        # Watch out for hash order randomization..
        is_deeply(
            $r->content,
            '["population",592393,"town","'."D\x{c3}\x{bc}sseldorf".'"]',
            "Integer from JSON body remains integer and route params decoded",
        );
    };
}

# Check body is deserialized on PATCH and DELETE.

 view all matches for this distribution


Dancer2-Session-DBIC

 view release on metacpan or  search on metacpan

CHANGES  view on Meta::CPAN


    [BUG FIXES]

    * Fix generating new sessions for every request
      (Peter Mottram, Rory Zweistra, GH #9).
    * Use decoded_content instead of content in UTF-8 tests
      (Peter Mottram, GH #8).

    [TESTS]

    * Stop Test::More complaining about wide chars in print (Peter Mottram).

 view all matches for this distribution


Dancer2-Session-DatabasePlugin

 view release on metacpan or  search on metacpan

t/Dancer2-Session-DatabasePlugin.t  view on Meta::CPAN

  {
    my $req=GET '/session/fetch',Cookie=>$cookie;
    my $res  = $test->request( $req );
    cmp_ok($res->code,'==',200,'Should get a 200');
    ok($cookie=$res->header($h),'Should have a cookie!');
    cmp_ok($res->decoded_content,'eq','I am a little teapot.');
    cmp_ok(keys(%{$SESSION->sth_cache}),'>',0,'Should have more than 0 statement handles');
  
  }
  {
    my $req=GET '/session/fetch',Cookie=>$cookie;
    my $res  = $test->request( $req );
    cmp_ok($res->code,'==',200,'Should get a 200');
    ok($cookie=$res->header($h),'Should have a cookie!');
    cmp_ok($res->decoded_content,'eq','I am a little teapot.');
    cmp_ok(keys(%{$SESSION->sth_cache}),'>',0,'Should have more than 0 statement handles');
    my @keys=keys %{$saved};
    is_deeply($saved,$SESSION->sth_cache,'Should have the same sth cache in both places') or die "Cannot continue testing";
    ok(join('',@{$saved}{@keys}) eq join('',@{$SESSION->sth_cache}{@keys}),'Statement handles should be cached') or die "cannot continue testing";

t/Dancer2-Session-DatabasePlugin.t  view on Meta::CPAN

  {
    my $req=GET '/session/fetch',Cookie=>$cookie;
    my $res  = $test->request( $req );
    cmp_ok($res->code,'==',200,'Should get a 200');
    ok($cookie=$res->header($h),'Should have a cookie!');
    cmp_ok($res->decoded_content,'eq','I am a little teapot.');
    cmp_ok(keys(%{$SESSION->sth_cache}),'>',0,'Should have more than 0 statement handles');
  }
  {
    my $req=GET 'disconnect2',Cookie=>$cookie;
    my $res  = $test->request( $req );

 view all matches for this distribution


Dancer2-Session-Memcached

 view release on metacpan or  search on metacpan

lib/Dancer2/Session/Memcached.pm  view on Meta::CPAN

    $self->_flush( $new_id, $self->_retrieve( $old_id ) );
    $self->_destroy( $old_id );
}

# reject anything where the first two bytes are below \x20 once
# Base64 decoded, ensuring Storable doesnt attempt to thaw such cruft.
sub validate_id {
    $_[1] =~ m/^[I-Za-z0-9_\-~][A-Za-z0-9_\-~]+$/;
}

1;

 view all matches for this distribution


Dancer2-Session-Redis

 view release on metacpan or  search on metacpan

t/Util.pm  view on Meta::CPAN

    my $res = $cb->($req);
    $jar->extract_cookies($res);
    subtest "$method $uri" => sub {
      plan tests => $expected_response ? 2 : 1;
      ok( $res->is_success, "request successful for $method $uri" );
      like( $res->decoded_content, $expected_response, "expected response content for $method $uri" )
        if $expected_response;
    };
    return;
  };
  test_psgi( $app, $client );

 view all matches for this distribution


Dancer2

 view release on metacpan or  search on metacpan

lib/Dancer2/Core/Request.pm  view on Meta::CPAN

# Private 'read-only' attributes for request params. See the params()
# method for the public interface.
#
# _body_params, _query_params and _route_params have setter methods that
# decode byte string to characters before setting; If you know you have
# decoded (character) params, such as output from a deserializer, you can
# set these directly in the request object hash to avoid the decode op.
sub _params { $_[0]->{'_params'} ||= $_[0]->_build_params }

sub _has_params { defined $_[0]->{'_params'} }

lib/Dancer2/Core/Request.pm  view on Meta::CPAN

    # returns characters and skipping the decode op in the setter ensures
    # that numerical data "stays" numerical; decoding an SV that is an IV
    # converts that to a PVIV. Some serializers are picky (JSON)..
    $self->{_body_params} = $data;

    # Set body parameters (decoded HMV)
    $self->{'body_parameters'} =
        Hash::MultiValue->from_mixed( is_hashref($data) ? %$data : () );

    return $data;
}

lib/Dancer2/Core/Request.pm  view on Meta::CPAN

    if ($type) {
        my $attr = "${type}_parameters";
        return $self->$attr;
    }

    # merge together the *decoded* parameters
    $self->{'merged_parameters'} ||= do {
        my $query = $self->query_parameters;
        my $body  = $self->body_parameters;
        my $route = $self->route_parameters; # not in Plack::Request
        Hash::MultiValue->new( map $_->flatten, $query, $body, $route );

lib/Dancer2/Core/Request.pm  view on Meta::CPAN

        $new_params->{$key} = $value;
        $new_request->{_query_params}->{$key} = $value;
        $new_request->{query_parameters}->add( $key => $value );
    }

    # Copy params (these are already decoded)
    $new_request->{_params}       = $new_params;
    $new_request->{_body_params}  = $self->{_body_params};
    $new_request->{_route_params} = $self->{_route_params};
    $new_request->{headers}       = $self->headers;

    # Copy remaining settings
    $new_request->{is_behind_proxy} = $self->{is_behind_proxy};
    $new_request->{vars}            = $self->{vars};

    # Clone any existing decoded & cached body params. (GH#1116 GH#1269)
    $new_request->{'body_parameters'} = $self->body_parameters->clone;

    # Delete merged HMV parameters, allowing them to be reconstructed on first use.
    delete $new_request->{'merged_parameters'};

lib/Dancer2/Core/Request.pm  view on Meta::CPAN

Returns the body of the request in data form, making it possible to distinguish
between C<body_parameters>, a representation of the request parameters
(L<Hash::MultiValue>) and other forms of content.

If a serializer is set, this is the deserialized request body. Otherwise this is
the decoded body parameters (if any), or the body content itself.

=head2 content

Returns the undecoded byte string POST body.

=head2 cookies

Returns a reference to a hash containing cookies, where the keys are the names of the
cookies and values are L<Dancer2::Core::Cookie> objects.

lib/Dancer2/Core/Request.pm  view on Meta::CPAN


Alias to the C<method> accessor, for backward-compatibility with C<CGI> interface.

=head2 request_uri

Return the raw, undecoded request URI path.

=head2 route

Return the L<route|Dancer2::Core::Route> which this request matched.

 view all matches for this distribution


( run in 1.334 second using v1.01-cache-2.11-cpan-9383018d099 )