print

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HighlightWithRegex

func HighlightWithRegex(text string, pattern string, baseFg lipgloss.Color, baseBg lipgloss.Color, highlightFg lipgloss.Color, highlightBg lipgloss.Color) string

func SprintBody

func SprintBody(size int64, body []byte, headers model.Headers, pretty bool) (string, string, error)

func SprintDotenv

func SprintDotenv(rawYaml string) (string, error)

func SprintFaint

func SprintFaint(str string) string

func SprintFullResponse

func SprintFullResponse(resp *model.Response) (string, string, error)

func SprintHeaders

func SprintHeaders(headers model.Headers, pretty bool) (string, string, error)

func SprintLua

func SprintLua(rawYaml string) (string, error)

func SprintPlainResponse

func SprintPlainResponse(resp *model.Response, printHeaders bool, printBody bool) (string, string, error)

func SprintPrettyFullResponse

func SprintPrettyFullResponse(resp *model.Response) (string, string, error)

func SprintPrettyResponse

func SprintPrettyResponse(resp *model.Response, printHeaders bool, printBody bool) (string, string, error)

func SprintRequest

func SprintRequest(request *model.Request, pretty bool) (string, string, error)

func SprintRequestMold

func SprintRequestMold(m *model.RequestMold) (string, error)

func SprintResponse

func SprintResponse(resp *model.Response, printOpts PrintOpts) (string, string, error)

func SprintStarlark

func SprintStarlark(rawYaml string) (string, error)

func SprintStatus

func SprintStatus(resp *model.Response, pretty bool) (string, string, error)

func SprintTraceInfo

func SprintTraceInfo(traceInfo model.TraceInfo, pretty bool) (string, string, error)

func SprintYaml

func SprintYaml(rawYaml string) (string, error)

Types

type BodyFormatHandler

type BodyFormatHandler interface {
	Supports(contentType string) bool
	Handle(body []byte) (string, error)
}

type BodyFormatter

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

func NewBodyFormatter

func NewBodyFormatter(handlers ...BodyFormatHandler) *BodyFormatter

func (*BodyFormatter) Format

func (d *BodyFormatter) Format(contentType string, body []byte) (string, error)

type DefaultContentTypeBodyHandler

type DefaultContentTypeBodyHandler struct{}

func (*DefaultContentTypeBodyHandler) Handle

func (h *DefaultContentTypeBodyHandler) Handle(body []byte) (string, error)

func (*DefaultContentTypeBodyHandler) Supports

func (h *DefaultContentTypeBodyHandler) Supports(contentType string) bool

type HtmlContentTypeBodyHandler

type HtmlContentTypeBodyHandler struct{}

func (*HtmlContentTypeBodyHandler) Handle

func (h *HtmlContentTypeBodyHandler) Handle(body []byte) (string, error)

func (*HtmlContentTypeBodyHandler) Supports

func (h *HtmlContentTypeBodyHandler) Supports(contentType string) bool

type JsonContentTypeBodyHandler

type JsonContentTypeBodyHandler struct{}

func (*JsonContentTypeBodyHandler) Handle

func (h *JsonContentTypeBodyHandler) Handle(body []byte) (string, error)

func (*JsonContentTypeBodyHandler) Supports

func (h *JsonContentTypeBodyHandler) Supports(contentType string) bool

type PrintOpts

type PrintOpts struct {
	PrettyPrint    bool
	PrintHeaders   bool
	PrintBody      bool
	PrintTraceInfo bool
	PrintRequest   bool
}

type XmlContentTypeBodyHandler

type XmlContentTypeBodyHandler struct{}

func (*XmlContentTypeBodyHandler) Handle

func (h *XmlContentTypeBodyHandler) Handle(body []byte) (string, error)

func (*XmlContentTypeBodyHandler) Supports

func (h *XmlContentTypeBodyHandler) Supports(contentType string) bool

Jump to

Keyboard shortcuts

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