GithubHelp home page GithubHelp logo

Comments (5)

jjn1056 avatar jjn1056 commented on June 26, 2024

Looks like to a bug to me, although I'm not personally keen on the auto length setting in Catalyst it should be corrected. I'm happy to get a patch, or at the very least give me a broken test case (checkout https://github.com/perl-catalyst/catalyst-runtime/blob/master/t/utf_incoming.t

and see if you can help me figure it out -jnap

from catalyst-runtime.

melmothx avatar melmothx commented on June 26, 2024

If you ask me, this is not a bug. application/json is not encoded by catalyst (as per doc) so it must be encoded to bytes before setting the body. Most serializers do that, so the wrong behavior here is just because of the manual json creation.

from catalyst-runtime.

jjn1056 avatar jjn1056 commented on June 26, 2024

@melmothx good catch, you'd think I'd remember that since I wrote the doc and made that call for back compat reasons. I wonder if the docs could not be more obvious and maybe I should add a config setting to 'force_json_encode_always' for people that are rolling their own... I guess I was thinking if you are doing that yourself I assume you know what you are doing...

from catalyst-runtime.

jjn1056 avatar jjn1056 commented on June 26, 2024

I'm thinking the docs should at least recommend one considers setting content length in your custom view, just to be safe.

from catalyst-runtime.

melmothx avatar melmothx commented on June 26, 2024

John Napiorkowski [email protected] writes:

I'm thinking the docs should at least recommend one considers setting
content length in your custom view, just to be safe.

I believe that if the string is passed correctly, the content length is
set by catalyst correct as well (or at least works for me so). In the OP
report, the length was off because chars were passed and setting the
length was not going to make the situation better (because of broken
encoding).

Marco

from catalyst-runtime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.