Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BodyParsingMiddleware #2798

Merged
merged 10 commits into from Aug 15, 2019
Merged

Add BodyParsingMiddleware #2798

merged 10 commits into from Aug 15, 2019

Commits on Aug 15, 2019

  1. Add BodyParsingMiddleware

    This middleware will parse the body of a PSR-7 ServerRequest and if the
    content-type is known and a parser is registered, it will add the
    parsed data to the request object before passing to the next middleware.
    
    Usage:
    
        use Slim\Factory\AppFactory;
        use Slim\Middleware\BodyParsingMiddleware;
        use Slim\Psr7\Response;
    
        $app = AppFactory::create();
        $app->add(new BodyParsingMiddleware());
    
        $app->post('/foo', function ($request) {
            $data = $request->getParsedBody();
    
            $response = new Response();
            $response->getBody()->write(
                print_r($data, true)
            );
            return new Response();
        });
    
        $app->run();
    akrabat committed Aug 15, 2019
    Copy the full SHA
    b573a00 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    d812554 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    14a1e99 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    ec0243a View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    3e973d7 View commit details
    Browse the repository at this point in the history
  6. Copy the full SHA
    b682dca View commit details
    Browse the repository at this point in the history
  7. Copy the full SHA
    093017e View commit details
    Browse the repository at this point in the history
  8. Copy the full SHA
    50ca8e8 View commit details
    Browse the repository at this point in the history
  9. Add addBodyParsingMiddleware() to App

    This follows the same style as addRoutingMiddleware() and
    addErrorMiddleware() in order to have consistent developer experience
    when adding a built-in Slim middleware component.
    akrabat committed Aug 15, 2019
    Copy the full SHA
    8af2dae View commit details
    Browse the repository at this point in the history
  10. Copy the full SHA
    84fe283 View commit details
    Browse the repository at this point in the history