Skip to content

[javascript-closure-angular]File uploads not working #6875

Open
@zihengcai

Description

@zihengcai
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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions