o.js icon indicating copy to clipboard operation
o.js copied to clipboard

Support for FormData

Open cloudsere opened this issue 3 years ago • 1 comments

Hi, does o.js plan to support FormData

I noticed that there're code in OHandler.ts which do a JSON.stringify on request body, which is not needed if the request body is FormData. https://github.com/janhommes/o.js/blob/ef5d27e7ebdc5ca348ca1d61a110771dda50469a/src/OHandler.ts#L236

cloudsere avatar Sep 07 '21 09:09 cloudsere

but it's only doing it if the type is object... otherwise, it is returning the body. So it should be already supported, or do you face any issues? Maybe the type check is not correct :/

https://stackoverflow.com/questions/46146637/detect-if-javascript-object-is-a-formdata-instance

maybe we need to use instanceof?

janhommes avatar Sep 07 '21 10:09 janhommes