Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Dancer-Plugin-REST CPAN distribution.

Report information
The Basics
Id: 78437
Status: resolved
Priority: 0/
Queue: Dancer-Plugin-REST

People
Owner: Nobody in particular
Requestors: andrew [...] illywhacker.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



From andrew.israel.solomon [...] gmail.com Tue Jul 17 17: 36:12 2012
CC: Andrew Solomon <andrew [...] illywhacker.net>
MIME-Version: 1.0
X-Spam-Status: No, score=-5.197 tagged_above=-99.9 required=10 tests=[AWL=0.921, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, NORMAL_HTTP_TO_IP=0.001, RCVD_IN_DNSWL_HI=-5, SPF_NEUTRAL=0.779, WEIRD_PORT=0.001] autolearn=ham
X-Spam-Flag: NO
content-type: text/plain; charset="utf-8"
Message-ID: <CAE+GCm6E_h53JzzHEYzdZRTqMAUHrshHgDcryDKjZOidoZ5BiQ [...] mail.gmail.com>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -5.197
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 529C42404D0 for <cpan-bug+Dancer-Plugin-REST [...] hipster.bestpractical.com>; Tue, 17 Jul 2012 17:36:12 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jKvvRKftoboU for <cpan-bug+Dancer-Plugin-REST [...] hipster.bestpractical.com>; Tue, 17 Jul 2012 17:36:07 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id A342E2404CD for <bug-Dancer-Plugin-REST [...] rt.cpan.org>; Tue, 17 Jul 2012 17:36:07 -0400 (EDT)
Received: (qmail 24110 invoked by uid 103); 17 Jul 2012 21:36:06 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 17 Jul 2012 21:36:06 -0000
Received: from mail-pb0-f50.google.com (HELO mail-pb0-f50.google.com) (209.85.160.50) by 16.mx.develooper.com (qpsmtpd/0.80/v0.80-19-gf52d165) with ESMTP; Tue, 17 Jul 2012 14:36:02 -0700
Received: by pbbrr4 with SMTP id rr4so1346843pbb.9 for <bug-Dancer-Plugin-REST [...] rt.cpan.org>; Tue, 17 Jul 2012 14:35:59 -0700 (PDT)
Received: by 10.68.218.7 with SMTP id pc7mr2558456pbc.88.1342560959858; Tue, 17 Jul 2012 14:35:59 -0700 (PDT)
Received: by 10.66.74.73 with HTTP; Tue, 17 Jul 2012 14:35:59 -0700 (PDT)
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Delivered-To: cpan-bug+Dancer-Plugin-REST [...] hipster.bestpractical.com
Subject: Dancer-Plugin-REST v0.07
Return-Path: <andrew.israel.solomon [...] gmail.com>
X-RT-Mail-Extension: dancer-plugin-rest
X-Original-To: cpan-bug+Dancer-Plugin-REST [...] hipster.bestpractical.com
X-Spam-Check-BY: 16.mx.develooper.com
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=5GyJ4xqSmA702NEFDBoADgpeGn7vCjv5nTuxHl5B96s=; b=cLaEOPLRwkgB2TRid4Z+fXp3Lthh00JumU5dQzk7y1/mfABZxXvL8L2ODb1WjEMngC BfNVqmPUeNUdXhpDQkmLk1P+FDxh+u3Zm8wV1SaY00Mg6pCy5nSRx/M478C5y8kGxYdp AyxU5CRzWWHX9Gjqj0SHBKYEMlS3lfdu5Sxd4Oxyh+9kyiaeSRIif1gvUENLvsONTOQk pKljLLzOOSFoxoFkjo352U2VLA9DtdbgWvSqMH0bIpfj9aXvbwueUMAi4F7NlmK5BVCk 0PfqmDtyObnSN3cSaX1FM60r2h4PV7O1bXicovZNHdkI7wP3Bazqs+v8JwpyLqHizIbX 6nmw==
X-Google-Sender-Auth: YyWTGNSOt3Phpn5RBDqtmi9H2HA
Sender: andrew.israel.solomon [...] gmail.com
Date: Tue, 17 Jul 2012 22:35:59 +0100
X-Spam-Level:
To: bug-Dancer-Plugin-REST [...] rt.cpan.org
From: Andrew Solomon <andrew [...] illywhacker.net>
X-RT-Original-Encoding: ISO-8859-1
Content-Length: 3193
Download (untitled) / with headers
text/plain 3.1k
It appears that the first call to a POST route fails. Below are two examples of the server, where the second one (which doesn't use Dancer::Plugin::REST) works fine. Context Info ========= Dancer (1.3097) Dancer::Plugin::REST (0.07) $ perl -v This is perl 5, version 12, subversion 4 (v5.12.4) built for x86_64-linux-gnu-thread-multi (with 45 registered patches, see perl -V for more detail) $ uname -a Linux gym 3.0.0-12-server #20-Ubuntu SMP Fri Oct 7 16:36:30 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux ======= The client ======== #!/usr/bin/perl use strict; use warnings; use URI; use LWP::UserAgent; use JSON; use Data::Dump qw/pp/; use feature qw/say/; # uri my $dns_uri = URI->new(); $dns_uri->scheme('http'); $dns_uri->authority('localhost'); $dns_uri->port (3000); $dns_uri->path('hw.json'); # request my $req = HTTP::Request->new (POST => $dns_uri); $req->content_type('application/json'); my $rh_post_data = { foo => 'bar', yin => 'yang' }; $req->content(to_json($rh_post_data)); say 'Request:'; say pp($req); # LWP my $lwp = LWP::UserAgent->new; my $res = $lwp->request( $req ); unless ($res->is_success) { say STDERR 'Error: '. $res->status_line; } say 'Response:'; say pp $res->content; ========== Client output (same for both servers) ========== andrew@gym:~/tmp/dancerbug $ ./client.pl Request: bless({ _content => "{\"yin\":\"yang\",\"foo\":\"bar\"}", _headers => bless({ "content-type" => "application/json" }, "HTTP::Headers"), _method => "POST", _uri => bless(do{\(my $o = "http://localhost:3000/hw.json")}, "URI::http"), }, "HTTP::Request") Response: "Hello world" ========= server.pl using Dancer::Plugin::REST ================= #!/usr/bin/perl use Dancer; use Dancer::Plugin::REST; use Data::Dump qw/pp/; set logger => 'console'; set log => 'debug'; set show_errors => 1; set port => 3000; prepare_serializer_for_format; post '/hw.:format' => sub { debug ("parameters: ".pp(params)); return 'Hello world'; }; dance; ============= Incorrect server output - first call doesn't catch {'yin': 'yang', 'foo': 'bar'} ====== $ ./server.pl.bug Show quoted text
>> Dancer 1.3097 server 7982 listening on http://0.0.0.0:3000 >> Dancer::Plugin::REST (0.07)
== Entering the development dance floor ... [7982] debug @0.007872> [hit #1]parameters: ("format", "json") in ./server.pl.bug l. 21 [7982] debug @0.001058> [hit #2]parameters: ("format", "json", "yin", "yang", "foo", "bar") in ./server.pl.bug l. 21 ======= server.pl without Dancer::Plugin::REST ============ #!/usr/bin/perl use Dancer; use Data::Dump qw/pp/; set logger => 'console'; set log => 'debug'; set show_errors => 1; set port => 3000; set serializer => 'JSON'; post '/hw.json' => sub { debug ("parameters: ".pp(params)); return 'Hello world'; }; ========= Correct server output ================ $ ./server.pl Show quoted text
>> Dancer 1.3097 server 7996 listening on http://0.0.0.0:3000 >> Dancer::Plugin::REST (0.07)
== Entering the development dance floor ... [7996] debug @0.000746> [hit #1]parameters: ("yin", "yang", "foo", "bar") in ./server.pl l. 18 [7996] debug @0.000712> [hit #2]parameters: ("yin", "yang", "foo", "bar") in ./server.pl l. 18
MIME-Version: 1.0
In-Reply-To: <CAE+GCm6E_h53JzzHEYzdZRTqMAUHrshHgDcryDKjZOidoZ5BiQ [...] mail.gmail.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <CAE+GCm6E_h53JzzHEYzdZRTqMAUHrshHgDcryDKjZOidoZ5BiQ [...] mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-10088-1394499647-1351.78437-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 213
Download (untitled) / with headers
text/plain 213b
The serializer wasn't detected in time for the deserialization. The second time around, it works before we don't clean ourselves after the first request. All fixed, and going to be pushed to CPAN in a few minutes.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.