finalize

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrettyPrintJSON

func PrettyPrintJSON(w io.Writer, content string)

PrettyPrintJSON formats and writes JSON content to w.

func Print

func Print(w io.Writer, summary Summary, body []byte, opts Options, root *os.Root) error

Print optionally saves the body, then writes the status/duration summary (headers under Verbose, status line only under Quiet) and the body.

func Response

func Response(
	w io.Writer,
	response *http.Response,
	body []byte,
	duration time.Duration,
	opts Options,
	root *os.Root,
) error

Response renders an HTTP response through Print.

Types

type Options

type Options struct {
	Save    bool
	Verbose bool
	// Quiet suppresses everything but the one-line status (`# @no-log`);
	// saving still happens when Save is set.
	Quiet bool
}

Options control what Response does with the already-read body.

type Summary

type Summary struct {
	StatusLine    string // e.g. "200 OK" or "14 Unavailable"
	StatusCode    int    // used in saved filenames
	Duration      time.Duration
	ContentLength int64
	Header        http.Header
	ContentType   string
}

Summary is the protocol-agnostic view of a finished request that Print renders: HTTP responses and gRPC outcomes both reduce to it.

Jump to

Keyboard shortcuts

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