Skip to content

Commit

Permalink
(Fixed #111) Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hahwul committed Sep 8, 2020
1 parent 2dcc365 commit 8617c49
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/optimization/optimization.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func MakeRequestQuery(target, param, payload, ptype string, options model.Option
if tempParam[param] == nil {
body = param+"="+payload+"&"+data
} else {
body = strings.Replace(options.Data, param+"="+tempParam[param][0], param+"="+tempParam[param][0]+payload, 1)
body = strings.Replace(body, param+"="+ url.QueryEscape(tempParam[param][0]), param+"="+ url.QueryEscape(tempParam[param][0])+payload, 1)
}
tempURL, _ := url.Parse(data)
tempQuery := tempURL.Query()
Expand All @@ -104,7 +104,7 @@ func MakeRequestQuery(target, param, payload, ptype string, options model.Option
if tempParam[param] == nil {
data = "?"+param+"="+payload+"&"+data
} else {
data = strings.Replace(data, param+"="+tempParam[param][0], param+"="+tempParam[param][0]+payload, 1)
data = strings.Replace(data, param+"="+ url.QueryEscape(tempParam[param][0]), param+"="+ url.QueryEscape(tempParam[param][0])+payload, 1)
}
tempURL, _ := url.Parse(data)
tempQuery := tempURL.Query()
Expand Down Expand Up @@ -160,7 +160,7 @@ func MakeURLEncodeRequestQuery(target, param, payload, ptype string, options mod
encodedPayload := UrlEncode(UrlEncode(payload))
if options.Data != "" {
tempParam, _ := url.ParseQuery(options.Data)
body := strings.Replace(options.Data, param+"="+tempParam[param][0], param+"="+tempParam[param][0]+encodedPayload, 1)
body := strings.Replace(options.Data, param+"="+url.QueryEscape(tempParam[param][0]), param+"="+url.QueryEscape(tempParam[param][0])+encodedPayload, 1)
tempURL, _ := url.Parse(data)
tempQuery := tempURL.Query()
tempURL.RawQuery = tempQuery.Encode()
Expand All @@ -170,7 +170,7 @@ func MakeURLEncodeRequestQuery(target, param, payload, ptype string, options mod

} else {
tempParam := u.Query()
data = strings.Replace(data, param+"="+tempParam[param][0], param+"="+tempParam[param][0]+encodedPayload, 1)
data = strings.Replace(data, param+"="+url.QueryEscape(tempParam[param][0]), param+"="+url.QueryEscape(tempParam[param][0])+encodedPayload, 1)
tempURL, _ := url.Parse(data)
tempQuery := tempURL.Query()
tempURL.RawQuery = tempQuery.Encode()
Expand All @@ -193,7 +193,7 @@ func MakeHTMLEncodeRequestQuery(target, param, payload, ptype string, options mo
encodedPayload := template.HTMLEscapeString(payload)
if options.Data != "" {
tempParam, _ := url.ParseQuery(options.Data)
body := strings.Replace(options.Data, param+"="+tempParam[param][0], param+"="+tempParam[param][0]+encodedPayload, 1)
body := strings.Replace(options.Data, param+"="+url.QueryEscape(tempParam[param][0]), param+"="+url.QueryEscape(tempParam[param][0])+encodedPayload, 1)
tempURL, _ := url.Parse(data)
tempQuery := tempURL.Query()
tempURL.RawQuery = tempQuery.Encode()
Expand All @@ -202,7 +202,7 @@ func MakeHTMLEncodeRequestQuery(target, param, payload, ptype string, options mo

} else {
tempParam := u.Query()
data = strings.Replace(data, param+"="+tempParam[param][0], param+"="+tempParam[param][0]+encodedPayload, 1)
data = strings.Replace(data, param+"="+url.QueryEscape(tempParam[param][0]), param+"="+url.QueryEscape(tempParam[param][0])+encodedPayload, 1)
tempURL, _ := url.Parse(data)
tempQuery := tempURL.Query()
tempURL.RawQuery = tempQuery.Encode()
Expand Down

0 comments on commit 8617c49

Please sign in to comment.