getMethod(); if (! in_array($method, ['PUT', 'PATCH'])) { return $out($request, $response); } $contentType = $request->getHeaderLine('Content-type'); $rawBody = (string) $request->getBody(); if (in_array($contentType, ['application/json', 'text/json', 'application/x-json'])) { return $out($request->withParsedBody(json_decode($rawBody, true)), $response); } $parsedBody = []; parse_str($rawBody, $parsedBody); return $out($request->withParsedBody($parsedBody), $response); } }