forked from loafle/openapi-generator-original
Updating security samples for Go-client. (#5290)
This commit is contained in:
parent
f44949db58
commit
cac803351b
@ -1,14 +1,13 @@
|
||||
# Go API client for swagger
|
||||
|
||||
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 --
|
||||
|
||||
## Overview
|
||||
This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client.
|
||||
|
||||
- API version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r
|
||||
- API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
- Package version: 1.0.0
|
||||
- Build date: 2016-07-12T18:49:24.937+08:00
|
||||
- Build package: class io.swagger.codegen.languages.GoClientCodegen
|
||||
- Build package: io.swagger.codegen.languages.GoClientCodegen
|
||||
|
||||
## Installation
|
||||
Put the package under your project folder and add the following in import:
|
||||
@ -18,11 +17,11 @@ Put the package under your project folder and add the following in import:
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end \\r\\n \\n \\r/v2 *_/ ' \" =end \\r\\n \\n \\r*
|
||||
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
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*FakeApi* | [**TestCodeInjectEndRnNR**](docs/FakeApi.md#testcodeinjectendrnnr) | **Put** /fake | To test code injection *_/ ' \" =end \\r\\n \\n \\r
|
||||
*FakeApi* | [**TestCodeInjectEndRnNR**](docs/FakeApi.md#testcodeinjectendrnnr) | **Put** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
@ -36,7 +35,7 @@ Class | Method | HTTP request | Description
|
||||
## api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key */ ' " =end \r\n \n \r
|
||||
- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
|
||||
- **Location**: HTTP header
|
||||
|
||||
## petstore_auth
|
||||
@ -45,11 +44,11 @@ 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 \r\n \n \r
|
||||
- **read:pets**: read your pets */ ' " =end \r\n \n \r
|
||||
- **write:pets**: modify pets in your account *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
- **read:pets**: read your pets *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
|
||||
apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
|
@ -1,23 +1,11 @@
|
||||
/*
|
||||
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
|
||||
* 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
|
||||
* 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 \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package swagger
|
||||
@ -29,10 +17,12 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"net/url"
|
||||
"io/ioutil"
|
||||
"github.com/go-resty/resty"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
config *Configuration
|
||||
}
|
||||
|
||||
func (c *APIClient) SelectHeaderContentType(contentTypes []string) string {
|
||||
@ -57,9 +47,9 @@ func (c *APIClient) SelectHeaderAccept(accepts []string) string {
|
||||
return strings.Join(accepts, ",")
|
||||
}
|
||||
|
||||
func contains(source []string, containvalue string) bool {
|
||||
for _, a := range source {
|
||||
if strings.ToLower(a) == strings.ToLower(containvalue) {
|
||||
func contains(haystack []string, needle string) bool {
|
||||
for _, a := range haystack {
|
||||
if strings.ToLower(a) == strings.ToLower(needle) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -74,11 +64,8 @@ func (c *APIClient) CallAPI(path string, method string,
|
||||
fileName string,
|
||||
fileBytes []byte) (*resty.Response, error) {
|
||||
|
||||
//set debug flag
|
||||
configuration := NewConfiguration()
|
||||
resty.SetDebug(configuration.GetDebug())
|
||||
|
||||
request := prepareRequest(postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
rClient := c.prepareClient()
|
||||
request := c.prepareRequest(rClient, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
switch strings.ToUpper(method) {
|
||||
case "GET":
|
||||
@ -101,33 +88,59 @@ func (c *APIClient) CallAPI(path string, method string,
|
||||
return nil, fmt.Errorf("invalid method %v", method)
|
||||
}
|
||||
|
||||
func (c *APIClient) ParameterToString(obj interface{},collectionFormat string) string {
|
||||
if reflect.TypeOf(obj).String() == "[]string" {
|
||||
switch collectionFormat {
|
||||
case "pipes":
|
||||
return strings.Join(obj.([]string), "|")
|
||||
case "ssv":
|
||||
return strings.Join(obj.([]string), " ")
|
||||
case "tsv":
|
||||
return strings.Join(obj.([]string), "\t")
|
||||
case "csv" :
|
||||
return strings.Join(obj.([]string), ",")
|
||||
}
|
||||
func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string {
|
||||
delimiter := ""
|
||||
switch collectionFormat {
|
||||
case "pipes":
|
||||
delimiter = "|"
|
||||
case "ssv":
|
||||
delimiter = " "
|
||||
case "tsv":
|
||||
delimiter = "\t"
|
||||
case "csv":
|
||||
delimiter = ","
|
||||
}
|
||||
|
||||
return obj.(string)
|
||||
if reflect.TypeOf(obj).Kind() == reflect.Slice {
|
||||
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%v", obj)
|
||||
}
|
||||
|
||||
func prepareRequest(postBody interface{},
|
||||
func (c *APIClient) prepareClient() *resty.Client {
|
||||
|
||||
rClient := resty.New()
|
||||
|
||||
rClient.SetDebug(c.config.Debug)
|
||||
if c.config.Transport != nil {
|
||||
rClient.SetTransport(c.config.Transport)
|
||||
}
|
||||
|
||||
if c.config.Timeout != nil {
|
||||
rClient.SetTimeout(*c.config.Timeout)
|
||||
}
|
||||
rClient.SetLogger(ioutil.Discard)
|
||||
return rClient
|
||||
}
|
||||
|
||||
func (c *APIClient) prepareRequest(
|
||||
rClient *resty.Client,
|
||||
postBody interface{},
|
||||
headerParams map[string]string,
|
||||
queryParams url.Values,
|
||||
formParams map[string]string,
|
||||
fileName string,
|
||||
fileBytes []byte) *resty.Request {
|
||||
|
||||
request := resty.R()
|
||||
|
||||
request := rClient.R()
|
||||
request.SetBody(postBody)
|
||||
|
||||
if c.config.UserAgent != "" {
|
||||
request.SetHeader("User-Agent", c.config.UserAgent)
|
||||
}
|
||||
|
||||
// add header parameter, if any
|
||||
if len(headerParams) > 0 {
|
||||
request.SetHeaders(headerParams)
|
||||
|
@ -1,23 +1,11 @@
|
||||
/*
|
||||
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
|
||||
* 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
|
||||
* 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 \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package swagger
|
||||
@ -27,8 +15,20 @@ import (
|
||||
)
|
||||
|
||||
type APIResponse struct {
|
||||
*http.Response
|
||||
*http.Response `json:"-"`
|
||||
Message string `json:"message,omitempty"`
|
||||
// Operation is the name of the swagger operation.
|
||||
Operation string `json:"operation,omitempty"`
|
||||
// RequestURL is the request URL. This value is always available, even if the
|
||||
// embedded *http.Response is nil.
|
||||
RequestURL string `json:"url,omitempty"`
|
||||
// Method is the HTTP method used for the request. This value is always
|
||||
// available, even if the embedded *http.Response is nil.
|
||||
Method string `json:"method,omitempty"`
|
||||
// Payload holds the contents of the response body (which may be nil or empty).
|
||||
// This is provided here as the raw response.Body() reader will have already
|
||||
// been drained.
|
||||
Payload []byte `json:"-"`
|
||||
}
|
||||
|
||||
func NewAPIResponse(r *http.Response) *APIResponse {
|
||||
|
@ -1,63 +1,57 @@
|
||||
/*
|
||||
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
|
||||
* 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
|
||||
* 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 \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
||||
type Configuration struct {
|
||||
UserName string `json:"userName,omitempty"`
|
||||
Username string `json:"userName,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"`
|
||||
APIKey map[string]string `json:"APIKey,omitempty"`
|
||||
debug bool `json:"debug,omitempty"`
|
||||
Debug bool `json:"debug,omitempty"`
|
||||
DebugFile string `json:"debugFile,omitempty"`
|
||||
OAuthToken string `json:"oAuthToken,omitempty"`
|
||||
Timeout int `json:"timeout,omitempty"`
|
||||
BasePath string `json:"basePath,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
AccessToken string `json:"accessToken,omitempty"`
|
||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||
UserAgent string `json:"userAgent,omitempty"`
|
||||
APIClient APIClient `json:"APIClient,omitempty"`
|
||||
APIClient *APIClient
|
||||
Transport *http.Transport
|
||||
Timeout *time.Duration `json:"timeout,omitempty"`
|
||||
}
|
||||
|
||||
func NewConfiguration() *Configuration {
|
||||
return &Configuration{
|
||||
BasePath: "https://petstore.swagger.io *_/ ' \" =end \\r\\n \\n \\r/v2 *_/ ' \" =end \\r\\n \\n \\r",
|
||||
UserName: "",
|
||||
debug: false,
|
||||
cfg := &Configuration{
|
||||
BasePath: "https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r",
|
||||
DefaultHeader: make(map[string]string),
|
||||
APIKey: make(map[string]string),
|
||||
APIKeyPrefix: make(map[string]string),
|
||||
UserAgent: "Swagger-Codegen/1.0.0/go",
|
||||
APIClient: &APIClient{},
|
||||
}
|
||||
|
||||
cfg.APIClient.config = cfg
|
||||
return cfg
|
||||
}
|
||||
|
||||
func (c *Configuration) GetBasicAuthEncodedString() string {
|
||||
return base64.StdEncoding.EncodeToString([]byte(c.UserName + ":" + c.Password))
|
||||
return base64.StdEncoding.EncodeToString([]byte(c.Username + ":" + c.Password))
|
||||
}
|
||||
|
||||
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
||||
@ -71,11 +65,3 @@ func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string {
|
||||
|
||||
return c.APIKey[APIKeyIdentifier]
|
||||
}
|
||||
|
||||
func (c *Configuration) SetDebug(enable bool) {
|
||||
c.debug = enable
|
||||
}
|
||||
|
||||
func (c *Configuration) GetDebug() bool {
|
||||
return c.debug
|
||||
}
|
||||
|
@ -1,23 +1,23 @@
|
||||
# \FakeApi
|
||||
|
||||
All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end \\r\\n \\n \\r/v2 *_/ ' \" =end \\r\\n \\n \\r*
|
||||
All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**TestCodeInjectEndRnNR**](FakeApi.md#TestCodeInjectEndRnNR) | **Put** /fake | To test code injection *_/ ' \" =end \\r\\n \\n \\r
|
||||
[**TestCodeInjectEndRnNR**](FakeApi.md#TestCodeInjectEndRnNR) | **Put** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
|
||||
# **TestCodeInjectEndRnNR**
|
||||
> TestCodeInjectEndRnNR($testCodeInjectEndRnNR)
|
||||
|
||||
To test code injection *_/ ' \" =end \\r\\n \\n \\r
|
||||
To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**testCodeInjectEndRnNR** | **string**| To test code injection *_/ ' \" =end \\r\\n \\n \\r | [optional]
|
||||
**testCodeInjectEndRnNR** | **string**| To test code injection *_/ ' \" =end -- \\r\\n \\n \\r | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -29,8 +29,8 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, *_/ ' =end
|
||||
- **Accept**: application/json, *_/ ' =end
|
||||
- **Content-Type**: application/json, *_/ ' =end --
|
||||
- **Accept**: application/json, *_/ ' =end --
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Return_** | **int32** | property description *_/ ' \" =end \\r\\n \\n \\r | [optional] [default to null]
|
||||
**Return_** | **int32** | property description *_/ ' \" =end -- \\r\\n \\n \\r | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -1,42 +1,28 @@
|
||||
/*
|
||||
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
|
||||
* 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
|
||||
* 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 \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"fmt"
|
||||
"errors"
|
||||
"net/url"
|
||||
)
|
||||
"strings"
|
||||
)
|
||||
|
||||
type FakeApi struct {
|
||||
Configuration Configuration
|
||||
Configuration *Configuration
|
||||
}
|
||||
|
||||
func NewFakeApi() *FakeApi {
|
||||
configuration := NewConfiguration()
|
||||
return &FakeApi{
|
||||
Configuration: *configuration,
|
||||
Configuration: configuration,
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,63 +31,66 @@ func NewFakeApiWithBasePath(basePath string) *FakeApi {
|
||||
configuration.BasePath = basePath
|
||||
|
||||
return &FakeApi{
|
||||
Configuration: *configuration,
|
||||
Configuration: configuration,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To test code injection *_/ ' \" =end \\r\\n \\n \\r
|
||||
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
*
|
||||
* @param testCodeInjectEndRnNR To test code injection *_/ ' \" =end \\r\\n \\n \\r
|
||||
* @param testCodeInjectEndRnNR To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* @return void
|
||||
*/
|
||||
func (a FakeApi) TestCodeInjectEndRnNR(testCodeInjectEndRnNR string) (*APIResponse, error) {
|
||||
|
||||
var httpMethod = "Put"
|
||||
var localVarHttpMethod = strings.ToUpper("Put")
|
||||
// create path and map variables
|
||||
path := a.Configuration.BasePath + "/fake"
|
||||
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := make(map[string]string)
|
||||
var postBody interface{}
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
localVarPath := a.Configuration.BasePath + "/fake"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := make(map[string]string)
|
||||
var localVarPostBody interface{}
|
||||
var localVarFileName string
|
||||
var localVarFileBytes []byte
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ "application/json", "*_/ ' =end ", }
|
||||
localVarHttpContentTypes := []string{ "application/json", "*_/ ' =end -- ", }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
headerParams["Content-Type"] = localVarHttpContentType
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/json",
|
||||
"*_/ ' =end ",
|
||||
}
|
||||
"*_/ ' =end -- ",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
localVarFormParams["testCodeInjectEndRnNR"] = a.Configuration.APIClient.ParameterToString(testCodeInjectEndRnNR, "")
|
||||
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
|
||||
var localVarURL, _ = url.Parse(localVarPath)
|
||||
localVarURL.RawQuery = localVarQueryParams.Encode()
|
||||
var localVarAPIResponse = &APIResponse{Operation: "TestCodeInjectEndRnNR", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
|
||||
if localVarHttpResponse != nil {
|
||||
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
|
||||
localVarAPIResponse.Payload = localVarHttpResponse.Body()
|
||||
}
|
||||
|
||||
formParams["testCodeInjectEndRnNR"] = testCodeInjectEndRnNR
|
||||
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
if err != nil {
|
||||
return NewAPIResponse(httpResponse.RawResponse), err
|
||||
return localVarAPIResponse, err
|
||||
}
|
||||
|
||||
return NewAPIResponse(httpResponse.RawResponse), err
|
||||
return localVarAPIResponse, err
|
||||
}
|
||||
|
||||
|
@ -1,30 +1,18 @@
|
||||
/*
|
||||
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
|
||||
* 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
|
||||
* 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 \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package swagger
|
||||
|
||||
// Model for testing reserved words *_/ ' \" =end \\r\\n \\n \\r
|
||||
// Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
type ModelReturn struct {
|
||||
|
||||
// property description *_/ ' \" =end \\r\\n \\n \\r
|
||||
// property description *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
Return_ int32 `json:"return,omitempty"`
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user