I am working on some scripts to test our infrastructure at various levels. I am trying to make tests to verify functionality for clients both with and without http2. The docs specify how to disable http2 by overriding Transport.TLSNextProto
, but I can't find any way to require http2.
Is there a way to require an http request uses http/2 only? Or if not is there any kind of field or hook to see if it used http2 or not?
You can use Response.ProtoAtLeast(2, 0)
to check if it came in over version 2. See: https://golang.org/pkg/net/http/#Response.ProtoAtLeast