MCPcopy Create free account
hub / github.com/keploy/keploy / recordLegacy

Method recordLegacy

pkg/agent/proxy/integrations/http/http.go:135–151  ·  view source on GitHub ↗

recordLegacy is the original RecordOutgoing body preserved unchanged. It consumes the legacy RecordSession fields (Ingress / Egress / Mocks) and forwards bytes between the real sockets itself. The V2 path in recordV2 relies on the supervisor's relay to do the forwarding and only observes teed chunks

(ctx context.Context, session *integrations.RecordSession)

Source from the content-addressed store, hash-verified

133// recordV2 relies on the supervisor's relay to do the forwarding and
134// only observes teed chunks via FakeConn streams.
135func (h *HTTP) recordLegacy(ctx context.Context, session *integrations.RecordSession) error {
136 logger := session.Logger
137
138 h.Logger.Debug("Recording the outgoing http call in record mode")
139
140 reqBuf, err := util.ReadInitialBuf(ctx, logger, session.Ingress)
141 if err != nil {
142 utils.LogError(logger, err, "failed to read the initial http message")
143 return err
144 }
145 err = h.encodeHTTP(ctx, reqBuf, session.Ingress, session.Egress, session.Mocks, session.Opts, session.OnMockRecorded)
146 if err != nil {
147 utils.LogError(logger, err, "failed to encode the http message into the yaml")
148 return err
149 }
150 return nil
151}
152
153func (h *HTTP) MockOutgoing(ctx context.Context, src net.Conn, dstCfg *models.ConditionalDstCfg, mockDb integrations.MockMemDb, opts models.OutgoingOptions) error {
154 // h.Logger = h.Logger.With(zap.Any("Client ConnectionID", ctx.Value(models.ClientConnectionIDKey).(string)), zap.Any("Destination ConnectionID", ctx.Value(models.DestConnectionIDKey).(string)), zap.Any("Client IP Address", src.RemoteAddr().String()))

Callers 1

RecordOutgoingMethod · 0.95

Calls 4

encodeHTTPMethod · 0.95
ReadInitialBufFunction · 0.92
LogErrorFunction · 0.92
DebugMethod · 0.65

Tested by

no test coverage detected