Dancer2-Serializer-JSONMaybeXS
view release on metacpan or search on metacpan
t/deserialize.t view on Meta::CPAN
like(
$content,
qr{\Q$utf8\E},
"utf-8 string returns the same using the JSONMaybeXS serializer",
);
};
}
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
'Content-Type' => 'application/json',
Content => encode_json({ population => 592393 }),
);
my $r = $cb->( POST @req_params );
# 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.
# The RFC states the behaviour for DELETE is undefined; We take the lenient
# and deserialize it.
# http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-24#section-4.3.5
note "Deserialze any body content that is allowed or undefined"; {
test_psgi $app, sub {
( run in 0.276 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )