MorayJ has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks

I'm using Dancer2 and trying to use request->content_encoding to get the encoding of the post data sent to me.

I am getting the exception below:

Route exception: Can't locate object method "content_encoding" via package "Dancer2::Core::Request"

This should exist as I'm looking at https://metacpan.org/pod/Dancer2::Core::Request#Common-HTTP-request-headers which lists the request headers

Others work in the format of request->content_length

Does anyone know if this is problem with Dancer2, with the way I might be implementing it (i.e. content_encoding is done differently to the others), or if it is somehow related to the code I am getting returned?

Any pointers much appreciated

Thanks

MorayJ

Replies are listed 'Best First'.
Re: Can't locate object method content_encoding in Dancer2 exception
by Anonymous Monk on Jul 08, 2016 at 11:02 UTC
    Which version?

      *shuffles feet awkwardly* v0.11

      Think you may have nailed this one as the document I'm using is for version 2.2

      Thanks. Will need to look into upgrading for general sanity anyway.

      MorayJ

        Yup, upgrading out of alpha did the trick

        I can't help thinking there's some kind of lesson to be learned here...