Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
33 changes: 16 additions & 17 deletions samples/client/petstore-security-test/javascript/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

28 changes: 14 additions & 14 deletions samples/client/petstore-security-test/javascript/docs/FakeApi.md
Original file line number Diff line number Diff line change
@@ -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


<a name="testCodeInjectEnd"></a>
# **testCodeInjectEnd**
> testCodeInjectEnd(opts)
<a name="testCodeInjectEndRnNR"></a>
# **testCodeInjectEndRnNR**
> testCodeInjectEndRnNR(opts)

To test code injection &#39; \&quot; &#x3D;end
To test code injection *_/ &#39; \&quot; &#x3D;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) {
Expand All @@ -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 &#39; \&quot; &#x3D;end | [optional]
**testCodeInjectEndRnNR** | **String**| To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r | [optional]

### Return type

Expand All @@ -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 --

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SwaggerPetstoreEnd.ModelReturn
# SwaggerPetstoreEndRnNR.ModelReturn

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_return** | **Integer** | property description &#39; \&quot; &#x3D;end | [optional]
**_return** | **Number** | property description *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r | [optional]


6 changes: 3 additions & 3 deletions samples/client/petstore-security-test/javascript/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
31 changes: 17 additions & 14 deletions samples/client/petstore-security-test/javascript/src/ApiClient.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 &#x3D;end
* @version 1.0.0 *_/ &#x3D;end -- \r\n \n \r
*/

/**
Expand All @@ -55,16 +55,16 @@
/**
* The base URL against which to resolve every API call's (relative) path.
* @type {String}
* @default https://petstore.swagger.io &#39; \&quot; &#x3D;end/v2 &#39; \&quot; &#x3D;end
* @default https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*/
this.basePath = 'https://petstore.swagger.io &#39; \&quot; &#x3D;end/v2 &#39; \&quot; &#x3D;end'.replace(/\/+$/, '');
this.basePath = 'https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r'.replace(/\/+$/, '');

/**
* The authentication methods to be included for all API calls.
* @type {Array.<String>}
*/
this.authentications = {
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key */ &#39; &quot; &#x3D;end'},
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r'},
'petstore_auth': {type: 'oauth2'}
};
/**
Expand Down Expand Up @@ -154,7 +154,7 @@
/**
* Checks whether the given parameter value represents file-like content.
* @param param The parameter to check.
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
*/
exports.prototype.isFileParam = function(param) {
// fs.ReadStream in Node.js (but not in runtime like browserify)
Expand Down Expand Up @@ -206,7 +206,7 @@

/**
* Enumeration of collection format separator strategies.
* @enum {String}
* @enum {String}
* @readonly
*/
exports.CollectionFormatEnum = {
Expand Down Expand Up @@ -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');
}
Expand Down
34 changes: 17 additions & 17 deletions samples/client/petstore-security-test/javascript/src/api/FakeApi.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -31,18 +31,18 @@
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';

/**
* Fake service.
* @module api/FakeApi
* @version 1.0.0 &#x3D;end
* @version 1.0.0 *_/ &#x3D;end -- \r\n \n \r
*/

/**
Expand All @@ -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 &#39; \&quot; &#x3D;end
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @param {Object} opts Optional parameters
* @param {String} opts.testCodeInjectEnd To test code injection &#39; \&quot; &#x3D;end
* @param {module:api/FakeApi~testCodeInjectEndCallback} callback The callback function, accepting three arguments: error, data, response
* @param {String} opts.testCodeInjectEndRnNR To test code injection *_/ &#39; \&quot; &#x3D;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;

Expand All @@ -82,12 +82,12 @@
var headerParams = {
};
var formParams = {
'test code inject */ &#39; &quot; &#x3D;end': opts['testCodeInjectEnd']
'test code inject */ &#39; &quot; &#x3D;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(
Expand Down
Loading