swagger-api/swagger-codegen

[javascript-closure-angular]File uploads not working

開放

#6,875 建立於 2017年11月3日

 (1 則留言) (0 個反應) (0 位負責人)HTML (5,474 個分叉)batch import
Client: JavaScript/Node.jsIssue: Bughelp wanted

倉庫指標

星標
 (12,701 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Description

The javascript-closure-angular client generated by swagger maven plugin and online swagger editor can’t upload file.

Swagger-codegen version

online swagger editor and swagger maven plugin version 2.2.2

Swagger declaration file content or url
put:
      consumes:
        - multipart/form-data
      parameters:
        - name: name
          in: query
          required: true
          type: string
        - name: schemaVersion
          in: query
          required: true
          type: string
        - name: dataVersion
          in: query
          required: true
          type: string
        - name: file
          in: formData
          required: true
          type: file
headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
 formParams['file'] = file;
  /** @type {!Object} */
  var httpRequestParams = {
    method: 'PUT',
    url: path,
    json: false,
        data: this.httpParamSerializer(formParams),
    params: queryParameters,
    headers: headerParams
  };
Command line used for generation

io.swagger swagger-codegen-maven-plugin ${swagger-codegen-maven-plugin.version} generate ${basedir}/../csputility/src/main/resources/api/servorch.yaml javascript-closure-angular ${basedir}/src/main/webapp/lib/swagger/

Suggest a fix/enhancement

When I upload the file ,the response status code is always 415,and I can't push any file. The generated client of angular for file uploading is different form $http in traditional angular,because the troditional one works well.

貢獻者指南