[Go]URLEncode path parameters (#3643)

* URLEncode path parameters

* update samples

* Use correct module naming
This commit is contained in:
Kris Raney
2019-08-16 05:58:54 -07:00
committed by William Cheng
parent 5182955cca
commit b83fe0c611
8 changed files with 22 additions and 22 deletions

View File

@@ -77,7 +77,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
// create path and map variables
localVarPath := a.client.cfg.BasePath + "{{{path}}}"{{#pathParams}}
localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", {{paramName}}), -1){{/pathParams}}
localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", url.QueryEscape(fmt.Sprintf("%v", {{paramName}})), -1){{/pathParams}}
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}

View File

@@ -77,7 +77,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams
// create path and map variables
localVarPath := a.client.cfg.BasePath + "{{{path}}}"{{#pathParams}}
localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", {{paramName}}), -1){{/pathParams}}
localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", {{paramName}})), -1){{/pathParams}}
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}

View File

@@ -118,7 +118,7 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -366,7 +366,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -539,7 +539,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -622,7 +622,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/pet/{petId}/uploadImage"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -735,7 +735,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/fake/{petId}/uploadImageWithRequiredFile"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}

View File

@@ -43,7 +43,7 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}"
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -210,7 +210,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}"
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}

View File

@@ -245,7 +245,7 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -313,7 +313,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -553,7 +553,7 @@ func (a *UserApiService) UpdateUser(ctx _context.Context, username string, body
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}

View File

@@ -117,7 +117,7 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -365,7 +365,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -538,7 +538,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -621,7 +621,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/pet/{petId}/uploadImage"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -734,7 +734,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/fake/{petId}/uploadImageWithRequiredFile"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", petId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}

View File

@@ -42,7 +42,7 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}"
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -209,7 +209,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}"
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", orderId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}

View File

@@ -244,7 +244,7 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -312,7 +312,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
@@ -552,7 +552,7 @@ func (a *UserApiService) UpdateUser(ctx _context.Context, username string, body
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", username)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}