Skip to content

Commit 71018d2

Browse files
author
Uğur Özyılmazel
committed
Fix header parser
1 parent b537d40 commit 71018d2

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
github.com/promptapi/scraper-go v0.1.2 h1:iYCVbrONu7hNkV2US1S7Qtn55w+wmDuZS17DPH/ifuE=
2-
github.com/promptapi/scraper-go v0.1.2/go.mod h1:ABmGIUogizw4JUmpR5gRXvT4KLgjgrJ8LFOnonjd2cw=
3-
github.com/promptapi/scraper-go v0.1.3 h1:wMgvae6Vj8asPN0YNBcNtYZjgAi8zhxLfI4cbroJ93I=
4-
github.com/promptapi/scraper-go v0.1.3/go.mod h1:ABmGIUogizw4JUmpR5gRXvT4KLgjgrJ8LFOnonjd2cw=
51
github.com/promptapi/scraper-go v0.1.4 h1:x5ijz9D8K9VicMVakesyYzpWDu5tl/XYgMbVSHgLwRU=
62
github.com/promptapi/scraper-go v0.1.4/go.mod h1:ABmGIUogizw4JUmpR5gRXvT4KLgjgrJ8LFOnonjd2cw=

pkg/app/app.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,11 @@ func (c *CLIApplication) Scrape() error {
185185

186186
if len(optHeaders) > 0 {
187187
for _, headerValue := range optHeaders {
188-
valuePair := strings.Split(headerValue, ":")
189188
reqHeader := new(scraper.ExtraHeader)
190-
reqHeader.Name = valuePair[0]
191-
reqHeader.Value = valuePair[1]
189+
190+
valuePair := strings.SplitAfterN(headerValue, ":", 2)
191+
reqHeader.Name = strings.TrimRight(valuePair[0], ":")
192+
reqHeader.Value = strings.TrimLeft(valuePair[1], " ")
192193
extraHeaders = append(extraHeaders, reqHeader)
193194
}
194195
}

0 commit comments

Comments
 (0)