[dancer-users] Dancer2::Plugin::REST breaks tests

Russell Jenkins russell.jenkins at strategicdata.com.au
Wed Jun 4 11:25:57 BST 2014


On 4/06/2014 10:10 am, Cymon wrote:
> I know there's already an issue open on CPAN RT about this problem, but
> are there news about a new release of the package?
There is a Pr that updates the code/tests to pass against the Dancer2 
release.
Hopefully Yanick has time to review/release.
> I spent some time looking into the problem, first fail should depends
> by the before hook in Dancer2::Core::Response. Comments here say that
> "All serializers return byte strings". I'm a bit curious about this...
> why was implemented this way considering that Serializer are something
> like YAML and JSON?
The HTTP protocol deals with octects, so the request and response data 
has to
be decoded/encoded somewhere. There is also no consistency between
the available serializers' deserialize/serialize methods; take the 
various YAML modules
as an example:
   * YAML::Dump() gives characters
   * YAML::XS::Dump gives octets
[ Which is why Dancer2 no longer uses YAML::Any ]. Since you need to end 
up with octets
(or byte strings) in the response body, it made sense to define that as 
the expectation
when something was serialized.

Hope that helps,
   Russell.



More information about the dancer-users mailing list