Skip to content

Commit 6041d73

Browse files
committed
Remove force user agent option
1 parent 5653a4d commit 6041d73

File tree

1 file changed

+11
-26
lines changed

1 file changed

+11
-26
lines changed

cmd/vulcan-zap/main.go

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@ type options struct {
4848
}
4949

5050
type tmplOptions struct {
51-
Opts options
52-
URL string
53-
IncludePath string
54-
Dir string
55-
UserAgent string
56-
ForceUserAgent bool // DOUBT: This is the only way to ensure all the requests have the same User-Agent. Do we want to force it?
51+
Opts options
52+
URL string
53+
IncludePath string
54+
Dir string
55+
UserAgent string
5756
}
5857

5958
const configTemplate = `
@@ -63,19 +62,6 @@ env:
6362
urls: [ "{{ .URL }}" ]
6463
includePaths: [ "{{ .IncludePath }}" ]
6564
jobs:
66-
{{ if .ForceUserAgent }}
67-
- type: script
68-
parameters:
69-
name: set-user-agent
70-
type: httpsender
71-
action: add
72-
engine: "ECMAScript : Graal.js"
73-
inline: |-
74-
function sendingRequest(msg, initiator, helper) {
75-
msg.getRequestHeader().setHeader("User-Agent", "{{ .UserAgent }}");
76-
}
77-
function responseReceived(msg, initiator, helper) {}
78-
{{ end }}
7965
{{ if .Opts.OpenapiUrl }}
8066
- type: openapi
8167
parameters:
@@ -188,7 +174,7 @@ var portPool *pool = createPortPool(13000, 5)
188174

189175
func main() {
190176
run := func(ctx context.Context, target, assetType, optJSON string, state checkstate.State) (err error) {
191-
logger := check.NewCheckLog(checkName)
177+
logger := check.NewCheckLogFromContext(ctx, checkName)
192178
var opt options
193179
if optJSON != "" {
194180
if err = json.Unmarshal([]byte(optJSON), &opt); err != nil {
@@ -229,12 +215,11 @@ func main() {
229215
}
230216
sb := new(strings.Builder)
231217
err = tmpl.Execute(sb, tmplOptions{
232-
Opts: opt,
233-
URL: targetURL.String(),
234-
Dir: tempDir,
235-
IncludePath: includePathRegex,
236-
UserAgent: userAgent,
237-
ForceUserAgent: false,
218+
Opts: opt,
219+
URL: targetURL.String(),
220+
Dir: tempDir,
221+
IncludePath: includePathRegex,
222+
UserAgent: userAgent,
238223
})
239224
if err != nil {
240225
return fmt.Errorf("unable to execute template: %w", err)

0 commit comments

Comments
 (0)