We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 55319b8 + 3d726e7 commit 22607e5Copy full SHA for 22607e5
example_test.go
@@ -4,6 +4,7 @@ import (
4
"fmt"
5
"io"
6
"net/http"
7
+ "time"
8
9
"github.com/jbowes/httpsig"
10
)
@@ -15,11 +16,14 @@ func Example_round_trip() {
15
16
w.Header().Set("Content-Type", "text/plain")
17
io.WriteString(w, "Your request has a valid signature!")
18
})
-
19
+
20
middleware := httpsig.NewVerifyMiddleware(httpsig.WithHmacSha256("key1", []byte(secret)))
21
http.Handle("/", middleware(h))
22
go func() { http.ListenAndServe("127.0.0.1:1234", http.DefaultServeMux) }()
23
24
+ // Give the server time to sleep. Terrible, I know.
25
+ time.Sleep(100 * time.Millisecond)
26
27
client := http.Client{
28
// Wrap the transport:
29
Transport: httpsig.NewSignTransport(http.DefaultTransport,
0 commit comments