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)
| 133 | // recordV2 relies on the supervisor's relay to do the forwarding and |
| 134 | // only observes teed chunks via FakeConn streams. |
| 135 | func (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 | |
| 153 | func (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())) |
no test coverage detected