Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: avoid to modify the original url request params #16

Merged
merged 1 commit into from
Dec 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions metricbeat/mb/parse/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (b URLHostParserBuilder) Build() mb.HostParser {
return func(module mb.Module, host string) (mb.HostData, error) {
conf := map[string]interface{}{}
err := module.UnpackConfig(conf)
var QueryParams string
if err != nil {
return mb.HostData{}, err
}
Expand All @@ -57,7 +58,7 @@ func (b URLHostParserBuilder) Build() mb.HostParser {
return mb.HostData{}, errors.Errorf("'query' config for module %v is not a map", module.Name())
}

b.QueryParams = mb.QueryParams(queryMap).String()
QueryParams = mb.QueryParams(queryMap).String()
}

var user, pass, path, basePath string
Expand Down Expand Up @@ -104,7 +105,7 @@ func (b URLHostParserBuilder) Build() mb.HostParser {
// Combine paths and normalize
fullPath := strings.Trim(p.Join(basePath, path), "/")

return ParseURL(host, b.DefaultScheme, user, pass, fullPath, b.QueryParams)
return ParseURL(host, b.DefaultScheme, user, pass, fullPath, QueryParams)
}
}

Expand Down