Ga naar inhoud

Blog

Laravel - PUT Request with Content-Type 'application/x-www-form-urlencoded' results in an empty request

curl -X PUT /api/example/update \ -H "Accept: application/json" \ -H "Authorization: Bearer your-access-token" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d '{"name":"David van der Tuijn"}'

Method Spoofing

Change the Content-Type to 'application/json' and add the key '_method' with value 'PUT'.

curl -X PUT /api/example/update \ -H "Accept: application/json" \ -H "Authorization: Bearer your-access-token" \ -H "Content-Type: application/json" \ -d '{"_method":"PUT","name":"David van der Tuijn"}'
Urls
Zoeken
Een moment geduld a.u.b....