Reputation: 5381
I am designing a RESTful API when I noticed something strange.
When I make a POST request for creating a new record, the form data is sent in request payload.
But when I make a PUT request to update a record, it appends form data in the URL, very similar to GET request.
Now a URL has certain length limit. So what would happen if PUT request has larger data than this limit.
Will the PUT request fail?
Is it unsafe to use PUT instead of POST to update a record having large form data?
EDIT: I am using NodeJS server. I am using restangular(angular framework) to build my PUT request.
Upvotes: 4
Views: 7773
Reputation: 2510
Use customPUT to send the form data in payload.
baseObj.customPUT(newObj).then(function(xyz){})
Upvotes: 2
Reputation: 69681
Have a look at these threads
Sounds like you can basically set a Content-type: multipart/form-data
header and be golden. Basically comes down to configuration of the request with restangular and support thereof on the NodeJS server.
Upvotes: 1