aboutsummaryrefslogtreecommitdiff
path: root/http_run_handler.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-03-15 13:58:56 +0700
committerShulhan <ms@kilabit.info>2024-03-15 13:58:56 +0700
commit8ba25dd9f5d823a4bd66967b33ee9d2624397129 (patch)
tree840b555620baf86b70f92f9553741a5ac39654eb /http_run_handler.go
parentcb9e9ecf8466386621954acdafc460ecd0c3f82f (diff)
downloadgorankusu-8ba25dd9f5d823a4bd66967b33ee9d2624397129.tar.xz
all: update module pakakeh.go to the tip
Diffstat (limited to 'http_run_handler.go')
-rw-r--r--http_run_handler.go27
1 files changed, 15 insertions, 12 deletions
diff --git a/http_run_handler.go b/http_run_handler.go
index 29eb8a1..44141f3 100644
--- a/http_run_handler.go
+++ b/http_run_handler.go
@@ -23,7 +23,7 @@ func DefaultHTTPRun() HTTPRunHandler {
return func(rr *RunRequest) (res *RunResponse, err error) {
var (
logp = `DefaultHTTPRun`
- httpcOpts = &libhttp.ClientOptions{
+ httpcOpts = libhttp.ClientOptions{
ServerURL: rr.Target.BaseURL,
AllowInsecure: true,
}
@@ -56,15 +56,18 @@ func DefaultHTTPRun() HTTPRunHandler {
}
}
- var httpRequest *http.Request
-
- httpRequest, err = httpc.GenerateHTTPRequest(
- rr.HTTPTarget.Method,
- rr.HTTPTarget.Path,
- rr.HTTPTarget.RequestType,
- headers,
- params,
+ var (
+ clientReq = libhttp.ClientRequest{
+ Method: rr.HTTPTarget.Method,
+ Path: rr.HTTPTarget.Path,
+ Type: rr.HTTPTarget.RequestType,
+ Header: headers,
+ Params: params,
+ }
+ httpRequest *http.Request
)
+
+ httpRequest, err = httpc.GenerateHTTPRequest(clientReq)
if err != nil {
return nil, fmt.Errorf(`%s: %w`, logp, err)
}
@@ -81,14 +84,14 @@ func DefaultHTTPRun() HTTPRunHandler {
return nil, fmt.Errorf(`%s: %w`, logp, err)
}
- var httpResponse *http.Response
+ var clientRes *libhttp.ClientResponse
- httpResponse, _, err = httpc.Do(httpRequest)
+ clientRes, err = httpc.Do(httpRequest)
if err != nil {
return nil, fmt.Errorf(`%s: %w`, logp, err)
}
- err = res.SetHTTPResponse(rr.HTTPTarget.ResponseDumper, httpResponse)
+ err = res.SetHTTPResponse(rr.HTTPTarget.ResponseDumper, clientRes.HTTPResponse)
if err != nil {
return nil, fmt.Errorf(`%s: %w`, logp, err)
}