diff --git a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache
index a85ebf9fbdd..d277079892c 100644
--- a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache
+++ b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache
@@ -363,7 +363,10 @@
var contentType = this.jsonPreferredMime(contentTypes);
if (contentType) {
- request.type(contentType);
+ // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
+ if(contentType != 'multipart/form-data') {
+ request.type(contentType);
+ }
} else if (!request.header['Content-Type']) {
request.type('application/json');
}
diff --git a/samples/client/petstore-security-test/javascript/README.md b/samples/client/petstore-security-test/javascript/README.md
index b77d3ebd6a0..f49c8f9d42e 100644
--- a/samples/client/petstore-security-test/javascript/README.md
+++ b/samples/client/petstore-security-test/javascript/README.md
@@ -1,12 +1,11 @@
-# swagger_petstore____end
+# swagger_petstore____end____rn_n_r
-SwaggerPetstoreEnd - JavaScript client for swagger_petstore____end
-This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end
+SwaggerPetstoreEndRnNR - JavaScript client for swagger_petstore____end____rn_n_r
+This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
-- API version: 1.0.0 ' \" =end
-- Package version: 1.0.0 =end
-- Build date: 2016-06-29T21:40:05.384+08:00
+- API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+- Package version: 1.0.0 *_/ =end -- \r\n \n \r
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
## Installation
@@ -21,7 +20,7 @@ please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.co
Then install it via:
```shell
-npm install swagger_petstore____end --save
+npm install swagger_petstore____end____rn_n_r --save
```
#### git
@@ -51,12 +50,12 @@ Then include *bundle.js* in the HTML pages.
Please follow the [installation](#installation) instruction and execute the following JS code:
```javascript
-var SwaggerPetstoreEnd = require('swagger_petstore____end');
+var SwaggerPetstoreEndRnNR = require('swagger_petstore____end____rn_n_r');
-var api = new SwaggerPetstoreEnd.FakeApi()
+var api = new SwaggerPetstoreEndRnNR.FakeApi()
var opts = {
- 'testCodeInjectEnd': "testCodeInjectEnd_example" // {String} To test code injection ' \" =end
+ 'testCodeInjectEndRnNR': "testCodeInjectEndRnNR_example" // {String} To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
};
var callback = function(error, data, response) {
@@ -66,22 +65,22 @@ var callback = function(error, data, response) {
console.log('API called successfully.');
}
};
-api.testCodeInjectEnd(opts, callback);
+api.testCodeInjectEndRnNR(opts, callback);
```
## Documentation for API Endpoints
-All URIs are relative to *https://petstore.swagger.io ' \" =end/v2 ' \" =end*
+All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
-*SwaggerPetstoreEnd.FakeApi* | [**testCodeInjectEnd**](docs/FakeApi.md#testCodeInjectEnd) | **PUT** /fake | To test code injection ' \" =end
+*SwaggerPetstoreEndRnNR.FakeApi* | [**testCodeInjectEndRnNR**](docs/FakeApi.md#testCodeInjectEndRnNR) | **PUT** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
## Documentation for Models
- - [SwaggerPetstoreEnd.ModelReturn](docs/ModelReturn.md)
+ - [SwaggerPetstoreEndRnNR.ModelReturn](docs/ModelReturn.md)
## Documentation for Authorization
@@ -90,7 +89,7 @@ Class | Method | HTTP request | Description
### api_key
- **Type**: API key
-- **API key parameter name**: api_key */ ' " =end
+- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
- **Location**: HTTP header
### petstore_auth
@@ -99,6 +98,6 @@ Class | Method | HTTP request | Description
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- - write:pets: modify pets in your account */ ' " =end
- - read:pets: read your pets */ ' " =end
+ - write:pets: modify pets in your account *_/ ' \" =end -- \\r\\n \\n \\r
+ - read:pets: read your pets *_/ ' \" =end -- \\r\\n \\n \\r
diff --git a/samples/client/petstore-security-test/javascript/docs/FakeApi.md b/samples/client/petstore-security-test/javascript/docs/FakeApi.md
index adbbd32fdb0..61b58cf72a9 100644
--- a/samples/client/petstore-security-test/javascript/docs/FakeApi.md
+++ b/samples/client/petstore-security-test/javascript/docs/FakeApi.md
@@ -1,26 +1,26 @@
-# SwaggerPetstoreEnd.FakeApi
+# SwaggerPetstoreEndRnNR.FakeApi
-All URIs are relative to *https://petstore.swagger.io ' \" =end/v2 ' \" =end*
+All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
Method | HTTP request | Description
------------- | ------------- | -------------
-[**testCodeInjectEnd**](FakeApi.md#testCodeInjectEnd) | **PUT** /fake | To test code injection ' \" =end
+[**testCodeInjectEndRnNR**](FakeApi.md#testCodeInjectEndRnNR) | **PUT** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
-
-# **testCodeInjectEnd**
-> testCodeInjectEnd(opts)
+
+# **testCodeInjectEndRnNR**
+> testCodeInjectEndRnNR(opts)
-To test code injection ' \" =end
+To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
### Example
```javascript
-var SwaggerPetstoreEnd = require('swagger_petstore____end');
+var SwaggerPetstoreEndRnNR = require('swagger_petstore____end____rn_n_r');
-var apiInstance = new SwaggerPetstoreEnd.FakeApi();
+var apiInstance = new SwaggerPetstoreEndRnNR.FakeApi();
var opts = {
- 'testCodeInjectEnd': "testCodeInjectEnd_example" // String | To test code injection ' \" =end
+ 'testCodeInjectEndRnNR': "testCodeInjectEndRnNR_example" // String | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
};
var callback = function(error, data, response) {
@@ -30,14 +30,14 @@ var callback = function(error, data, response) {
console.log('API called successfully.');
}
};
-apiInstance.testCodeInjectEnd(opts, callback);
+apiInstance.testCodeInjectEndRnNR(opts, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
- **testCodeInjectEnd** | **String**| To test code injection ' \" =end | [optional]
+ **testCodeInjectEndRnNR** | **String**| To test code injection *_/ ' \" =end -- \\r\\n \\n \\r | [optional]
### Return type
@@ -49,6 +49,6 @@ No authorization required
### HTTP request headers
- - **Content-Type**: application/json, */ =end
- - **Accept**: application/json, */ =end
+ - **Content-Type**: application/json, *_/ =end --
+ - **Accept**: application/json, *_/ =end --
diff --git a/samples/client/petstore-security-test/javascript/docs/ModelReturn.md b/samples/client/petstore-security-test/javascript/docs/ModelReturn.md
index 2341e97142f..e542020a95c 100644
--- a/samples/client/petstore-security-test/javascript/docs/ModelReturn.md
+++ b/samples/client/petstore-security-test/javascript/docs/ModelReturn.md
@@ -1,8 +1,8 @@
-# SwaggerPetstoreEnd.ModelReturn
+# SwaggerPetstoreEndRnNR.ModelReturn
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
-**_return** | **Integer** | property description ' \" =end | [optional]
+**_return** | **Number** | property description *_/ ' \" =end -- \\r\\n \\n \\r | [optional]
diff --git a/samples/client/petstore-security-test/javascript/package.json b/samples/client/petstore-security-test/javascript/package.json
index 13a19a00ad3..89f2c51c2c2 100644
--- a/samples/client/petstore-security-test/javascript/package.json
+++ b/samples/client/petstore-security-test/javascript/package.json
@@ -1,7 +1,7 @@
{
- "name": "swagger_petstore____end",
- "version": "1.0.0 =end",
- "description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters_______end",
+ "name": "swagger_petstore____end____rn_n_r",
+ "version": "1.0.0 *_/ =end -- \r\n \n \r",
+ "description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters_______end______",
"license": "Apache-2.0",
"main": "src/index.js",
"scripts": {
diff --git a/samples/client/petstore-security-test/javascript/src/ApiClient.js b/samples/client/petstore-security-test/javascript/src/ApiClient.js
index b22ed5202a5..20e0bc173fe 100644
--- a/samples/client/petstore-security-test/javascript/src/ApiClient.js
+++ b/samples/client/petstore-security-test/javascript/src/ApiClient.js
@@ -1,9 +1,9 @@
/**
- * Swagger Petstore ' \" =end
- * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
- * OpenAPI spec version: 1.0.0 ' \" =end
- * Contact: apiteam@swagger.io ' \" =end
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -31,17 +31,17 @@
module.exports = factory(require('superagent'));
} else {
// Browser globals (root is window)
- if (!root.SwaggerPetstoreEnd) {
- root.SwaggerPetstoreEnd = {};
+ if (!root.SwaggerPetstoreEndRnNR) {
+ root.SwaggerPetstoreEndRnNR = {};
}
- root.SwaggerPetstoreEnd.ApiClient = factory(root.superagent);
+ root.SwaggerPetstoreEndRnNR.ApiClient = factory(root.superagent);
}
}(this, function(superagent) {
'use strict';
/**
* @module ApiClient
- * @version 1.0.0 =end
+ * @version 1.0.0 *_/ =end -- \r\n \n \r
*/
/**
@@ -55,16 +55,16 @@
/**
* The base URL against which to resolve every API call's (relative) path.
* @type {String}
- * @default https://petstore.swagger.io ' \" =end/v2 ' \" =end
+ * @default https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r
*/
- this.basePath = 'https://petstore.swagger.io ' \" =end/v2 ' \" =end'.replace(/\/+$/, '');
+ this.basePath = 'https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r'.replace(/\/+$/, '');
/**
* The authentication methods to be included for all API calls.
* @type {Array.
* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following:
*
* A non-AMD browser application (discouraged) might do something like this:
* true
if param
represents a file.
+ * @returns {Boolean} true
if param
represents a file.
*/
exports.prototype.isFileParam = function(param) {
// fs.ReadStream in Node.js (but not in runtime like browserify)
@@ -206,7 +206,7 @@
/**
* Enumeration of collection format separator strategies.
- * @enum {String}
+ * @enum {String}
* @readonly
*/
exports.CollectionFormatEnum = {
@@ -376,7 +376,10 @@
var contentType = this.jsonPreferredMime(contentTypes);
if (contentType) {
- request.type(contentType);
+ // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
+ if(contentType != 'multipart/form-data') {
+ request.type(contentType);
+ }
} else if (!request.header['Content-Type']) {
request.type('application/json');
}
diff --git a/samples/client/petstore-security-test/javascript/src/api/FakeApi.js b/samples/client/petstore-security-test/javascript/src/api/FakeApi.js
index f2ccf169d90..f7585314e66 100644
--- a/samples/client/petstore-security-test/javascript/src/api/FakeApi.js
+++ b/samples/client/petstore-security-test/javascript/src/api/FakeApi.js
@@ -1,9 +1,9 @@
/**
- * Swagger Petstore ' \" =end
- * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
- * OpenAPI spec version: 1.0.0 ' \" =end
- * Contact: apiteam@swagger.io ' \" =end
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -31,10 +31,10 @@
module.exports = factory(require('../ApiClient'));
} else {
// Browser globals (root is window)
- if (!root.SwaggerPetstoreEnd) {
- root.SwaggerPetstoreEnd = {};
+ if (!root.SwaggerPetstoreEndRnNR) {
+ root.SwaggerPetstoreEndRnNR = {};
}
- root.SwaggerPetstoreEnd.FakeApi = factory(root.SwaggerPetstoreEnd.ApiClient);
+ root.SwaggerPetstoreEndRnNR.FakeApi = factory(root.SwaggerPetstoreEndRnNR.ApiClient);
}
}(this, function(ApiClient) {
'use strict';
@@ -42,7 +42,7 @@
/**
* Fake service.
* @module api/FakeApi
- * @version 1.0.0 =end
+ * @version 1.0.0 *_/ =end -- \r\n \n \r
*/
/**
@@ -57,20 +57,20 @@
/**
- * Callback function to receive the result of the testCodeInjectEnd operation.
- * @callback module:api/FakeApi~testCodeInjectEndCallback
+ * Callback function to receive the result of the testCodeInjectEndRnNR operation.
+ * @callback module:api/FakeApi~testCodeInjectEndRnNRCallback
* @param {String} error Error message, if any.
* @param data This operation does not return a value.
* @param {String} response The complete HTTP response.
*/
/**
- * To test code injection ' \" =end
+ * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
* @param {Object} opts Optional parameters
- * @param {String} opts.testCodeInjectEnd To test code injection ' \" =end
- * @param {module:api/FakeApi~testCodeInjectEndCallback} callback The callback function, accepting three arguments: error, data, response
+ * @param {String} opts.testCodeInjectEndRnNR To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
+ * @param {module:api/FakeApi~testCodeInjectEndRnNRCallback} callback The callback function, accepting three arguments: error, data, response
*/
- this.testCodeInjectEnd = function(opts, callback) {
+ this.testCodeInjectEndRnNR = function(opts, callback) {
opts = opts || {};
var postBody = null;
@@ -82,12 +82,12 @@
var headerParams = {
};
var formParams = {
- 'test code inject */ ' " =end': opts['testCodeInjectEnd']
+ 'test code inject */ ' " =end -- \r\n \n \r': opts['testCodeInjectEndRnNR']
};
var authNames = [];
- var contentTypes = ['application/json', '*/ =end'];
- var accepts = ['application/json', '*/ =end'];
+ var contentTypes = ['application/json', '*_/ =end -- '];
+ var accepts = ['application/json', '*_/ =end -- '];
var returnType = null;
return this.apiClient.callApi(
diff --git a/samples/client/petstore-security-test/javascript/src/index.js b/samples/client/petstore-security-test/javascript/src/index.js
index 6c5081c188c..3a2295732ee 100644
--- a/samples/client/petstore-security-test/javascript/src/index.js
+++ b/samples/client/petstore-security-test/javascript/src/index.js
@@ -1,9 +1,9 @@
/**
- * Swagger Petstore ' \" =end
- * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
- * OpenAPI spec version: 1.0.0 ' \" =end
- * Contact: apiteam@swagger.io ' \" =end
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -34,14 +34,14 @@
'use strict';
/**
- * This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters_______end.
+ * This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters_______end______.
* The index
module provides access to constructors for all the classes which comprise the public API.
*
- * var SwaggerPetstoreEnd = require('index'); // See note below*.
- * var xxxSvc = new SwaggerPetstoreEnd.XxxApi(); // Allocate the API class we're going to use.
- * var yyyModel = new SwaggerPetstoreEnd.Yyy(); // Construct a model instance.
+ * var SwaggerPetstoreEndRnNR = require('index'); // See note below*.
+ * var xxxSvc = new SwaggerPetstoreEndRnNR.XxxApi(); // Allocate the API class we're going to use.
+ * var yyyModel = new SwaggerPetstoreEndRnNR.Yyy(); // Construct a model instance.
* yyyModel.someProperty = 'someValue';
* ...
* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
@@ -53,8 +53,8 @@
*
- * var xxxSvc = new SwaggerPetstoreEnd.XxxApi(); // Allocate the API class we're going to use.
- * var yyy = new SwaggerPetstoreEnd.Yyy(); // Construct a model instance.
+ * var xxxSvc = new SwaggerPetstoreEndRnNR.XxxApi(); // Allocate the API class we're going to use.
+ * var yyy = new SwaggerPetstoreEndRnNR.Yyy(); // Construct a model instance.
* yyyModel.someProperty = 'someValue';
* ...
* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
@@ -62,7 +62,7 @@
*
*
ModelReturn
.
- * Model for testing reserved words ' \" =end
+ * Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
* @alias module:model/ModelReturn
* @class
*/
@@ -72,15 +72,15 @@
obj = obj || new exports();
if (data.hasOwnProperty('return')) {
- obj['return'] = ApiClient.convertToType(data['return'], 'Integer');
+ obj['return'] = ApiClient.convertToType(data['return'], 'Number');
}
}
return obj;
}
/**
- * property description ' \" =end
- * @member {Integer} return
+ * property description *_/ ' \" =end -- \\r\\n \\n \\r
+ * @member {Number} return
*/
exports.prototype['return'] = undefined;
diff --git a/samples/client/petstore/javascript/docs/FakeApi.md b/samples/client/petstore/javascript/docs/FakeApi.md
index b754b8815cf..4be1079607b 100644
--- a/samples/client/petstore/javascript/docs/FakeApi.md
+++ b/samples/client/petstore/javascript/docs/FakeApi.md
@@ -90,7 +90,8 @@ var opts = {
'binary': "B", // String | None
'_date': new Date("2013-10-20"), // Date | None
'dateTime': new Date("2013-10-20T19:20:30+01:00"), // Date | None
- 'password': "password_example" // String | None
+ 'password': "password_example", // String | None
+ 'callback': "callback_example" // String | None
};
var callback = function(error, data, response) {
@@ -120,6 +121,7 @@ Name | Type | Description | Notes
**_date** | **Date**| None | [optional]
**dateTime** | **Date**| None | [optional]
**password** | **String**| None | [optional]
+ **callback** | **String**| None | [optional]
### Return type
diff --git a/samples/client/petstore/javascript/src/ApiClient.js b/samples/client/petstore/javascript/src/ApiClient.js
index 1ca3143bc09..720b9417343 100644
--- a/samples/client/petstore/javascript/src/ApiClient.js
+++ b/samples/client/petstore/javascript/src/ApiClient.js
@@ -377,7 +377,10 @@
var contentType = this.jsonPreferredMime(contentTypes);
if (contentType) {
- request.type(contentType);
+ // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
+ if(contentType != 'multipart/form-data') {
+ request.type(contentType);
+ }
} else if (!request.header['Content-Type']) {
request.type('application/json');
}
diff --git a/samples/client/petstore/javascript/src/api/FakeApi.js b/samples/client/petstore/javascript/src/api/FakeApi.js
index 0d4ccca70ef..edda32926dc 100644
--- a/samples/client/petstore/javascript/src/api/FakeApi.js
+++ b/samples/client/petstore/javascript/src/api/FakeApi.js
@@ -125,6 +125,7 @@
* @param {Date} opts._date None
* @param {Date} opts.dateTime None
* @param {String} opts.password None
+ * @param {String} opts.callback None
* @param {module:api/FakeApi~testEndpointParametersCallback} callback The callback function, accepting three arguments: error, data, response
*/
this.testEndpointParameters = function(_number, _double, patternWithoutDelimiter, _byte, opts, callback) {
@@ -171,7 +172,8 @@
'binary': opts['binary'],
'date': opts['_date'],
'dateTime': opts['dateTime'],
- 'password': opts['password']
+ 'password': opts['password'],
+ 'callback': opts['callback']
};
var authNames = ['http_basic_test'];