MCPcopy Index your code
hub / github.com/keploy/keploy / replayTargetHasHTTP2Mock

Method replayTargetHasHTTP2Mock

pkg/agent/proxy/proxy.go:900–912  ·  view source on GitHub ↗

replayTargetHasHTTP2Mock reports whether a kind:Http2 mock was recorded for THIS connection's destination (sniHost + port). ALPN is negotiated per-connection before any request is seen, so the decision must be scoped to the destination being dialed: a session-global check ("any Http2 mock at all") w

(sniHost string, port uint32)

Source from the content-addressed store, hash-verified

898// load after it was built and carry a destination's h2 preference into a later
899// test-set where that destination is HTTP/1.1-only.
900func (p *Proxy) replayTargetHasHTTP2Mock(sniHost string, port uint32) bool {
901 m := p.getMockManager()
902 if m == nil {
903 return false
904 }
905 return m.HasMocksByKind(models.HTTP2, func(mk *models.Mock) bool {
906 if mk.Spec.HTTP2Req == nil {
907 return false
908 }
909 h, pt := hostPortFromAuthority(mk.Spec.HTTP2Req.Authority, mk.Spec.HTTP2Req.Scheme)
910 return http2DestMatches(strings.ToLower(h), pt, sniHost, port)
911 })
912}
913
914// http2DestMatches reports whether a recorded Http2 destination (aHost:aPort,
915// aHost lower-cased) matches the connection destination sniHost:port. A

Callers 1

handleConnectionMethod · 0.95

Implementers 1

Proxypkg/agent/proxy/proxy.go

Calls 4

getMockManagerMethod · 0.95
hostPortFromAuthorityFunction · 0.85
http2DestMatchesFunction · 0.85
HasMocksByKindMethod · 0.80

Tested by

no test coverage detected