Created
November 14, 2017 17:52
-
-
Save zukasmichael/02354827897bb9facb6dc8718952755d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// json request parser | |
$app->before(function ($request) { | |
if (0 === strpos($request->headers->get('Content-Type'), 'application/json')) { | |
$data = json_decode($request->getContent(), true); | |
$request->request->replace(is_array($data) ? $data : []); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment