Giter Club home page Giter Club logo

Comments (5)

mnapoli avatar mnapoli commented on August 15, 2024

Thanks! That's weird, I'm using POST requests on another project and that worked fine. I will do additional tests.

Oh wait maybe I should do parse_str only for specific POST requests. E.g. if it's a POST request but JSON is sent then you don't want the body to be parsed. I think that may be it.

from bref.

radutopala avatar radutopala commented on August 15, 2024

Yeah, that should be it. I sent the json directly in the body.

from bref.

mnapoli avatar mnapoli commented on August 15, 2024

The approach of Zend Expressive is interesting, they have a middleware that will apply the correct "strategy" of decoding the body based on the header: https://github.com/zendframework/zend-expressive-helpers/blob/master/src/BodyParams/BodyParamsMiddleware.php
The downside is that it's a middleware, and JSON decoding is not really something that PHP does natively. I don't want this package to do more than what PHP does natively, frameworks already deal with JSON.

Slim's approach in it's base PSR-7 implementation is simpler:

https://github.com/slimphp/Slim-Http/blob/305e7572084d6476939ffd9f71e388ab847ecbc3/src/Request.php#L122-L127

from bref.

radutopala avatar radutopala commented on August 15, 2024

Slim's implementation looks natural and straightforward indeed.

from bref.

mnapoli avatar mnapoli commented on August 15, 2024

#2 fixes this problem.

from bref.

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.