Skip to content

Commit 9fd124f

Browse files
authored
Merge branch 'dev' into dev
2 parents 6045e85 + 9f4a057 commit 9fd124f

File tree

8 files changed

+31
-19
lines changed

8 files changed

+31
-19
lines changed

.github/workflows/build-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616
os: [ubuntu-latest, windows-latest, macOS-latest]
1717
steps:
1818
- name: Set up Go
19-
uses: actions/setup-go@v4
19+
uses: actions/setup-go@v5
2020
with:
2121
go-version: 1.21.x
2222

2323
- name: Check out code
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2525

2626
- name: Build
2727
run: go build .

.github/workflows/lint-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ jobs:
1414
steps:
1515

1616
- name: Checkout code
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818

1919
- name: Set up Go
20-
uses: actions/setup-go@v4
20+
uses: actions/setup-go@v5
2121
with:
2222
go-version: 1.21.x
2323

2424
- name: Run golangci-lint
25-
uses: golangci/golangci-lint-action@v3.6.0
25+
uses: golangci/golangci-lint-action@v6
2626
with:
2727
version: latest
2828
args: --timeout 5m

.github/workflows/release-binary.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ jobs:
1111
runs-on: ubuntu-latest-16-cores
1212
steps:
1313
- name: "Check out code"
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515
with:
1616
fetch-depth: 0
1717

1818
- name: "Set up Go"
19-
uses: actions/setup-go@v4
19+
uses: actions/setup-go@v5
2020
with:
2121
go-version: 1.21.x
2222

2323
- name: "Create release on GitHub"
24-
uses: goreleaser/goreleaser-action@v4
24+
uses: goreleaser/goreleaser-action@v6
2525
with:
2626
args: "release --rm-dist"
2727
version: latest

.github/workflows/release-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ jobs:
1212
runs-on: ubuntu-latest-16-cores
1313
steps:
1414
- name: "Check out code"
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
1818

1919
- name: Set up Go
20-
uses: actions/setup-go@v4
20+
uses: actions/setup-go@v5
2121
with:
2222
go-version: 1.21.x
2323

2424
- name: release test
25-
uses: goreleaser/goreleaser-action@v4
25+
uses: goreleaser/goreleaser-action@v6
2626
with:
2727
args: "release --clean --snapshot"
2828
version: latest

internal/runner/runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,5 @@ func (r *Runner) Close() {
138138
func printDslCompileError(err error) {
139139
gologger.Error().Msgf("error compiling DSL: %s", err)
140140
gologger.Info().Msgf("The available custom DSL functions are:")
141-
gologger.Info().Label("").Msgf(dsl.GetPrintableDslFunctionSignatures(false))
141+
gologger.Info().Label("").Msg(dsl.GetPrintableDslFunctionSignatures(false))
142142
}

pkg/logger/logger.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,15 @@ func NewLogger(options *OptionsLogger) *Logger {
101101

102102
// LogRequest and user data
103103
func (l *Logger) LogRequest(req *http.Request, userdata types.UserData) error {
104-
// No-op for now , since proxify isn't intended to fail instead return 502
105-
// and request can be accessed via response.Request
104+
if req == nil {
105+
return nil
106+
}
107+
108+
// send to writer channel
109+
l.asyncqueue <- types.HTTPTransaction{
110+
Userdata: userdata,
111+
Request: req,
112+
}
106113
return nil
107114
}
108115

@@ -168,10 +175,12 @@ func (l *Logger) AsyncWrite() {
168175
URL: httpData.Request.URL.String(),
169176
}
170177
defer func() {
171-
// write to structured writer with whatever data we have
172-
err := l.sWriter.Write(sData)
173-
if err != nil {
174-
gologger.Warning().Msgf("Error while logging: %s", err)
178+
if sData.Response != nil {
179+
// write to structured writer with whatever data we have
180+
err := l.sWriter.Write(sData)
181+
if err != nil {
182+
gologger.Warning().Msgf("Error while logging: %s", err)
183+
}
175184
}
176185
}()
177186
sRequest, err := types.NewHttpRequestData(httpData.Request)

pkg/types/userdata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func NewHttpRequestData(req *http.Request) (*HTTPRequest, error) {
7676
httpRequest.Body = string(reqBody)
7777

7878
// Extract raw request
79-
reqdumpNoBody, err := httputil.DumpRequest(req, false)
79+
reqdumpNoBody, err := httputil.DumpRequest(req, true)
8080
if err != nil {
8181
return nil, err
8282
}

proxy.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ func NewProxy(options *Options) (*Proxy, error) {
199199

200200
// ModifyRequest
201201
func (p *Proxy) ModifyRequest(req *http.Request) error {
202+
// // Set Content-Length to zero to allow automatic calculation
203+
req.ContentLength = -1
204+
202205
ctx := martian.NewContext(req)
203206
// disable upgrading http connections to https by default
204207
ctx.Session().MarkInsecure()

0 commit comments

Comments
 (0)