forked from swagger-api/swagger-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request swagger-api#10135 from swagger-api/beardeddragon5-…
…go-with-formurlencoded Beardeddragon5 go with formurlencoded
- Loading branch information
Showing
10 changed files
with
700 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
* 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 -- | ||
* | ||
* API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r | ||
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
|
||
package swagger | ||
|
||
import ( | ||
"context" | ||
"io/ioutil" | ||
"net/http" | ||
"net/url" | ||
"strings" | ||
"github.com/antihax/optional" | ||
) | ||
|
||
// Linger please | ||
var ( | ||
_ context.Context | ||
) | ||
|
||
type FakeApiService service | ||
|
||
/* | ||
FakeApiService To test code injection *_/ ' \" =end -- \\r\\n \\n \\r | ||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). | ||
* @param optional nil or *TestCodeInjectEndRnNROpts - Optional Parameters: | ||
* @param "TestCodeInjectEndRnNR" (optional.String) - To test code injection *_/ ' \" =end -- \\r\\n \\n \\r | ||
*/ | ||
|
||
type TestCodeInjectEndRnNROpts struct { | ||
TestCodeInjectEndRnNR optional.String | ||
} | ||
|
||
func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOptionals *TestCodeInjectEndRnNROpts) (*http.Response, error) { | ||
var ( | ||
localVarHttpMethod = strings.ToUpper("Put") | ||
localVarPostBody interface{} | ||
localVarFileName string | ||
localVarFileBytes []byte | ||
|
||
) | ||
|
||
// create path and map variables | ||
localVarPath := a.client.cfg.BasePath + "/fake" | ||
|
||
localVarHeaderParams := make(map[string]string) | ||
localVarQueryParams := url.Values{} | ||
localVarFormParams := url.Values{} | ||
|
||
// to determine the Content-Type header | ||
localVarHttpContentTypes := []string{"application/json", "*_/ ' =end -- "} | ||
|
||
// set Content-Type header | ||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) | ||
if localVarHttpContentType != "" { | ||
localVarHeaderParams["Content-Type"] = localVarHttpContentType | ||
} | ||
|
||
// to determine the Accept header | ||
localVarHttpHeaderAccepts := []string{"application/json", "*_/ ' =end -- "} | ||
|
||
// set Accept header | ||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) | ||
if localVarHttpHeaderAccept != "" { | ||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept | ||
} | ||
if localVarOptionals != nil && localVarOptionals.TestCodeInjectEndRnNR.IsSet() { | ||
localVarFormParams.Add("test code inject */ ' " =end -- \r\n \n \r", parameterToString(localVarOptionals.TestCodeInjectEndRnNR.Value(), "")) | ||
} | ||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
localVarHttpResponse, err := a.client.callAPI(r) | ||
if err != nil || localVarHttpResponse == nil { | ||
return localVarHttpResponse, err | ||
} | ||
|
||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) | ||
localVarHttpResponse.Body.Close() | ||
if err != nil { | ||
return localVarHttpResponse, err | ||
} | ||
|
||
|
||
if localVarHttpResponse.StatusCode >= 300 { | ||
newErr := GenericSwaggerError{ | ||
body: localVarBody, | ||
error: localVarHttpResponse.Status, | ||
} | ||
|
||
return localVarHttpResponse, newErr | ||
} | ||
|
||
return localVarHttpResponse, nil | ||
} |
Oops, something went wrong.