From 0d3f7e8b206e40fec810287fdc03c6d8278c0519 Mon Sep 17 00:00:00 2001 From: ariary Date: Fri, 23 Sep 2022 09:48:37 +0200 Subject: [PATCH] refactor function name --- pkg/client/client.go | 6 +++--- pkg/request/request.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/client/client.go b/pkg/client/client.go index 018cce5..cc16281 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -198,14 +198,14 @@ func Redirect(cfg *config.ClientConfig, response response.Response) (redirectRes } cfg.AddrPort = addr path := "/" + strings.Join(strings.Split(location, "/")[4:], "/") - cfg.Request.ChangePath(path) + cfg.Request.SetPath(path) //Update Host cfg.Request.Headers["Host"] = []string{strings.Split(cfg.AddrPort, ":")[0]} default: - cfg.Request.ChangePath(location) + cfg.Request.SetPath(location) } - cfg.Request.ChangeMethod("GET") + cfg.Request.SetMethod("GET") // add cookie if present if cookies := response.Cookies; len(cookies) > 0 { for i := 0; i < len(cookies); i++ { diff --git a/pkg/request/request.go b/pkg/request/request.go index 89bec70..04af667 100644 --- a/pkg/request/request.go +++ b/pkg/request/request.go @@ -35,16 +35,16 @@ func GetRawHTTPRequest(req Request) (rawRequest []byte) { return rawRequest } -//ChangePath: Change the path uri with the one provided for the HTTP Request (modify first line of the raw request) -func (request *Request) ChangePath(path string) { +//SetPath: Change the path uri with the one provided for the HTTP Request (modify first line of the raw request) +func (request *Request) SetPath(path string) { commandLineSplitted := strings.Split(request.CommandLine, " ") //(0: medthod, 1:path 2: version) commandLineSplitted[1] = path request.CommandLine = strings.Join(commandLineSplitted, " ") } -//ChangeMethod: Change the method for the HTTP Request (modify first line of the raw request + request obect) -func (request *Request) ChangeMethod(nMethod string) { +//SetMethod: Change the method for the HTTP Request (modify first line of the raw request + request obect) +func (request *Request) SetMethod(nMethod string) { request.Method = nMethod commandLineSplitted := strings.Split(request.CommandLine, " ") //(0: medthod, 1:path 2: version) commandLineSplitted[0] = nMethod