atuttle / Taffy

:candy: The REST Web Service framework for ColdFusion and Lucee
http://taffy.io
Other
226 stars 118 forks source link

PUT method formData #372

Open mgsakata opened 6 years ago

mgsakata commented 6 years ago

Hello,

I noticed an old issue https://github.com/atuttle/Taffy/issues/15, which is similar to what I am experiencing. In particular I have a form where I am uploading a file and there is no problem with the POST request, but with the PUT request none of the arguments in the resource are being supplied.

Is this bit of text from your docs relevant?

Prior to versions 4.1.1.002 and 4.2 of Lucee, a PUT request would populate the FORM scope.

I've been going through the api.cfc and parseRequest(). I've noticed that for POST the FORM data is used to set the requestObj.requestArguments, however, with the PUT there is no FORM data, and the body is not being parsed. getRequestBody() is taking the Binary data from the PUT request and converting to UTF-8, but then nothing appears happens with the body data.

I'm not sure whether I am missing something?

The content-type seems to be appearing properly with the boundary value matching the boundary values which appear in the UTF-8 decoded body. Is there a function which should be using that boundary value to parse the body? I can't seem to find one, but its getting late, so tired eyes may be to fault.

Thank you for any insights you can provide.

atuttle commented 6 years ago

getRequestBody() is taking the Binary data from the PUT request and converting to UTF-8, but then nothing appears happens with the body data.

That doesn't sound good. I have seen that PUT requests (IMO incorrectly) don't parse body data and only work with the data in the URL as query parameters, but haven't had time to debug it and was able to get by with URL params. Sounds like you found the issue. Would you mind submitting a PR to fix it?