Skip to content

Commit e0c7dc9

Browse files
committed
Add --show-error to CurlWithCustomReporter
Use long-form flags to make the errors more readable.
1 parent 7f027e7 commit e0c7dc9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

helpers/internal/curl.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ func Curl(cmdStarter internal.Starter, skipSsl bool, args ...string) *gexec.Sess
1111
}
1212

1313
func CurlWithCustomReporter(cmdStarter internal.Starter, reporter internal.Reporter, skipSsl bool, args ...string) *gexec.Session {
14-
curlArgs := append([]string{"-s"}, args...)
15-
curlArgs = append([]string{"-H", "Expect:"}, curlArgs...)
14+
curlArgs := append([]string{"--silent"}, args...)
15+
curlArgs = append([]string{"--show-error"}, curlArgs...)
16+
curlArgs = append([]string{"--header", "Expect:"}, curlArgs...)
1617
if skipSsl {
17-
curlArgs = append([]string{"-k"}, curlArgs...)
18+
curlArgs = append([]string{"--insecure"}, curlArgs...)
1819
}
1920

2021
request, err := cmdStarter.Start(reporter, "curl", curlArgs...)

helpers/internal/curl_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ var _ = Describe("Curl", func() {
5454
Expect(session).To(Exit(0))
5555
Expect(session.Out).To(Say("HTTP/1.1 200 OK"))
5656
Expect(starter.CalledWith[0].Executable).To(Equal("curl"))
57-
Expect(starter.CalledWith[0].Args).To(ConsistOf("-H", "Expect:", "-I", "-s", "http://example.com"))
57+
Expect(starter.CalledWith[0].Args).To(ConsistOf("--header", "Expect:", "-I", "--show-error", "--silent", "http://example.com"))
5858
})
5959

6060
It("uses the specified reporter", func() {

0 commit comments

Comments
 (0)