I have a method that requires both formData and path parameters. How can I set the data in the request?

I am using swagger-js v2.

Let's say the example below requires 3 parameters:

  1. ResetPassword is a path parameter
  2. password is a formData parameter
  3. repeat_password is a formData parameter

swagger_client.apis.users.resetPassword(<HELP!!>, 
function(response) {
    // success
}, function(err) {
    // failure
}); 

1

There are 1 best solutions below

0
On

I'm not sure if this is still relevant for you but I stucked at the same problem and found a solution.

Define your parameter object like this:

var paramObj = {
                              ResetPassword: "resetpw",
                              parameterContentType: "multipart/form-data",
                              password: formData1,
                              repeat_password: formData2

                           };

then call with

swagger_client.apis.users.resetPassword(paramObj,...