Open ostronom opened 7 years ago
HTTP/2.0 should be transparently and implicitly supported. gock works at higher level than L7, then no network layer is actually involved.
Are you having any troubles?
Yes, i do have trouble with http2 client.
func apnsMatcher(r *http.Request, g *gock.Request) (bool, error) {
fmt.Printf("URL = %s", r.URL.Path)
return true, nil
}
gock.New("https://api.push.apple.com").
AddMatcher(apnsMatcher).
Persist().
Reply(200).
JSON(result)
And when I do request anything at https://api.push.apple.com/some/path using apns2 client (it uses http2 transport), I see nothing in the console.
Are you using a custom http.Client
, instead of http.DefaultClient
? In that case, you should instrument gock
on it first. See: https://github.com/h2non/gock/blob/master/_examples/custom_client/client_test.go#L18-L20
Are there any plans to support http2 transport mocking?