From 3e3dc478fc9b4eb90681df89156dfcc8f7f81481 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Mon, 13 Sep 2010 13:31:56 +0200 Subject: initial import --- t/spore-middleware/format-xml.t | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 t/spore-middleware/format-xml.t (limited to 't/spore-middleware/format-xml.t') diff --git a/t/spore-middleware/format-xml.t b/t/spore-middleware/format-xml.t new file mode 100644 index 0000000..0a01633 --- /dev/null +++ b/t/spore-middleware/format-xml.t @@ -0,0 +1,30 @@ +use strict; +use warnings; + +use Test::More; +use XML::Simple; + +use Net::HTTP::Spore; + +ok my $client = + Net::HTTP::Spore->new_from_spec( 't/specs/couchdb.json', + api_base_url => 'http://localhost:5984' ); + +my $content = { keys => [qw/1 2 3/] }; + +$client->enable('Format::XML'); +$client->enable( + 'Test::Response', + body => XMLout($content), + headers => [ 'Content-Type' => 'text/xml' ] +); + +my $res = $client->get_all_documents( database => 'test_spore' ); +is $res->[0], 200; +is_deeply $res->[2], $content; +is $res->header('Content-Type'), 'text/xml'; + +my $req = $res->request; +is $req->header('Accept'), 'text/xml'; + +done_testing; -- cgit v1.2.3