You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note how Illuminate\Http\Request is casting "products":{} as "products": [].
We are expecting the empty object products to be casted as it is, an empty JSON object, instead of an empty array.
This is also replicable on Laravel 8.x.
A similar issue was already reported here and closed without solution.
The text was updated successfully, but these errors were encountered:
Description:
When sending a POST or PUT request providing JSON data in the body the
Illuminate\Http\Request
class will cast any empty JSON object as empty array.Steps To Reproduce:
Create a simple route that will just output the received request:
Send a POST or PUT request to the above created endpoint with a JSON payload containing an empty JSON object:
The response of that request will be:
Note how
Illuminate\Http\Request
is casting"products":{}
as"products": []
.We are expecting the empty object
products
to be casted as it is, an empty JSON object, instead of an empty array.This is also replicable on Laravel 8.x.
A similar issue was already reported here and closed without solution.
The text was updated successfully, but these errors were encountered: