[英]How to properly set the data in swagger-js client for a PUT request which requires BOTH formData and path parameters?
I have a method that requires both formData and path parameters. 我有一个需要formData和path参数的方法。 How can I set the data in the request? 如何设置请求中的数据?
I am using swagger-js v2. 我正在使用swagger-js v2。
Let's say the example below requires 3 parameters: 假设以下示例需要3个参数:
ResetPassword
is a path parameter ResetPassword
是路径参数 password
is a formData parameter password
是一个formData参数 repeat_password
is a formData parameter repeat_password
是一个formData参数 swagger_client.apis.users.resetPassword(<HELP!!>, function(response) { // success }, function(err) { // failure });
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,...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.