@@ -294,7 +294,8 @@ public function withUploadedFiles(array $uploadedFiles)
294294 */
295295 public function getRawBody (): string
296296 {
297- return $ this ->coRequest ->rawContent ();
297+ $ body = $ this ->coRequest ->rawContent ();
298+ return ($ body === false ) ? '' : $ body ;
298299 }
299300
300301 /**
@@ -306,17 +307,23 @@ public function getRawBody(): string
306307 public function getParsedBody ()
307308 {
308309 // Need init
309- if ($ this ->parsedBody === null ) {
310- $ parsedBody = $ this ->coRequest ->post ?? [];
310+ if ($ this ->parsedBody !== null ) {
311+ return $ this ->parsedBody ;
312+ }
311313
312- // Parse body
313- if (!$ parsedBody && !$ this ->isGet ()) {
314- $ parsedBody = $ this ->parseRawBody ($ this ->getRawBody ());
315- }
316314
317- $ this ->parsedBody = $ parsedBody ;
315+ $ parsedBody = $ this ->coRequest ->post ?? [];
316+
317+ // Parse body
318+ if (!$ parsedBody && !$ this ->isGet ()) {
319+ $ rawBody = $ this ->getRawBody ();
320+ if (!empty ($ rawBody )) {
321+ $ parsedBody = $ this ->parseRawBody ($ rawBody );
322+ }
318323 }
319324
325+ $ this ->parsedBody = $ parsedBody ;
326+
320327 return $ this ->parsedBody ;
321328 }
322329
@@ -365,12 +372,13 @@ public function getAttributes(): array
365372
366373 /**
367374 * @inheritdoc
368- * @see getAttributes()
369375 *
370376 * @param string $name The attribute name.
371377 * @param mixed $default Default value to return if the attribute does not exist.
372378 *
373379 * @return mixed
380+ * @see getAttributes()
381+ *
374382 */
375383 public function getAttribute ($ name , $ default = null )
376384 {
@@ -380,12 +388,12 @@ public function getAttribute($name, $default = null)
380388 /**
381389 * @inheritdoc
382390 *
383- * @see getAttributes()
384- *
385391 * @param string $name The attribute name.
386392 * @param mixed $value The value of the attribute.
387393 *
388394 * @return static
395+ * @see getAttributes()
396+ *
389397 */
390398 public function withAttribute ($ name , $ value )
391399 {
@@ -398,11 +406,11 @@ public function withAttribute($name, $value)
398406 /**
399407 * @inheritdoc
400408 *
401- * @see getAttributes()
402- *
403409 * @param string $name The attribute name.
404410 *
405411 * @return static
412+ * @see getAttributes()
413+ *
406414 */
407415 public function withoutAttribute ($ name )
408416 {
0 commit comments