http

package
v2.1.0-alpha9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

README

Http Package Documentation

The http package encompasses the parser and mapping logic required to read HTTP text messages and capture or stub the outputs. Utilized by the hooks package, it aids in redirecting outgoing calls for the purpose of recording or stubbing the outputs.

Documentation

Overview

Package http provides functionality for handling HTTP outgoing calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTP

func NewHTTP(logger *zap.Logger) integrations.Integrations

func ParseFinalHTTP

func ParseFinalHTTP(_ context.Context, logger *zap.Logger, mock *finalHTTP, destPort uint, mocks chan<- *models.Mock, opts models.OutgoingOptions) error

ParseFinalHTTP is used to parse the final http request and response and save it in a yaml file

Types

type ContentType

type ContentType string
const (
	Unknown   ContentType = "Unknown"
	JSON      ContentType = "JSON"
	XML       ContentType = "XML"
	CSV       ContentType = "CSV"
	HTML      ContentType = "HTML"
	TextPlain ContentType = "TextPlain"
)

Constants for different content types.

type HTTP

type HTTP struct {
	// contains filtered or unexported fields
}

func (*HTTP) MatchType

func (h *HTTP) MatchType(_ context.Context, buf []byte) bool

MatchType function determines if the outgoing network call is HTTP by comparing the message format with that of an HTTP text message.

func (*HTTP) MockOutgoing

func (h *HTTP) MockOutgoing(ctx context.Context, src net.Conn, dstCfg *integrations.ConditionalDstCfg, mockDb integrations.MockMemDb, opts models.OutgoingOptions) error

func (*HTTP) RecordOutgoing

func (h *HTTP) RecordOutgoing(ctx context.Context, src net.Conn, dst net.Conn, mocks chan<- *models.Mock, opts models.OutgoingOptions) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL