Skip to content

Commit 3d726e7

Browse files
authored
Sleep in the example test
This could make it less flakey, but is terrible.
1 parent 55319b8 commit 3d726e7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

example_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"io"
66
"net/http"
7+
"time"
78

89
"github.com/jbowes/httpsig"
910
)
@@ -15,11 +16,14 @@ func Example_round_trip() {
1516
w.Header().Set("Content-Type", "text/plain")
1617
io.WriteString(w, "Your request has a valid signature!")
1718
})
18-
19+
1920
middleware := httpsig.NewVerifyMiddleware(httpsig.WithHmacSha256("key1", []byte(secret)))
2021
http.Handle("/", middleware(h))
2122
go func() { http.ListenAndServe("127.0.0.1:1234", http.DefaultServeMux) }()
2223

24+
// Give the server time to sleep. Terrible, I know.
25+
time.Sleep(100 * time.Millisecond)
26+
2327
client := http.Client{
2428
// Wrap the transport:
2529
Transport: httpsig.NewSignTransport(http.DefaultTransport,

0 commit comments

Comments
 (0)