diff --git a/main.go b/main.go index b590e61..fb715df 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,7 @@ func init() { "", } - fmt.Fprintf(os.Stderr, strings.Join(h, "\n")) + fmt.Fprint(os.Stderr, strings.Join(h, "\n")) } } diff --git a/module.go b/module.go index 3e983cc..a2dafb5 100644 --- a/module.go +++ b/module.go @@ -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) @@ -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 }