loopback-api-testing
loopback-api-testing copied to clipboard
How to test a function which sends form-data in request?
Assuming you mean a route which accepts a HTTP POST request, just put the form data in the withData
field of the test.
I have a request where I am uploading files using a multipart form-data. I tried putting the file path in the withData
field. It showed me an error of "Unsupported file type 415", which is an error I am not throwing anywhere in the code.
I assume it's because there is no Content-Type
or Content-Encoding
headers with the request. Currently an open issue if you want to add those to the package.