Skip to content

Commit

Permalink
Merge pull request #2 from detectify/fix/err-check
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
tomnomnom authored May 18, 2021
2 parents 1019fec + a6757d6 commit 9580f33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func init() {
"",
}

fmt.Fprintf(os.Stderr, strings.Join(h, "\n"))
fmt.Fprint(os.Stderr, strings.Join(h, "\n"))
}
}

Expand Down
8 changes: 3 additions & 5 deletions module.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@ func newModule(filename string) (*module, error) {
}

func (m *module) newRequest(baseURL, path string) (*http.Request, error) {

req, err := http.NewRequest(
m.Request.Method,
baseURL+path,
bytes.NewBuffer([]byte(m.Request.Body)),
)
if err != nil {
return nil, err
}

for _, h := range m.Request.Headers {
parts := strings.SplitN(h, ":", 2)
Expand All @@ -102,10 +104,6 @@ func (m *module) newRequest(baseURL, path string) (*http.Request, error) {
req.Header.Set(k, v)
}

if err != nil {
return nil, err
}

return req, nil
}

Expand Down

0 comments on commit 9580f33

Please # to comment.