httputil

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package httputil provides basic utilities for working with and inspecting HTTP requests and responses.

Index

Constants

View Source
const RequestID = "X-Request-ID"

RequestID is the name of the header expected to contain a unique identifier for incoming requests and their matching outgoing responses.

Variables

This section is empty.

Functions

func DumpRequest

func DumpRequest(r *http.Request)

// DumpRequest prints r to stderr including headers and the request body. The request is reset after printing so it's safe to reuse. If the request can't be dumped, an error is emitted to stderr instead.

func DumpResponse

func DumpResponse(resp *http.Response)

DumpResponse prints resp to stderr including the headers and body. The response is reset after printing so it's safe to reuse. If the response can't be dumped, an error is emitted to stderr instead.

func RealIP

func RealIP(r *http.Request) string

RealIP returns the best guess at the originating IP address for an incoming request.

Types

This section is empty.

Jump to

Keyboard shortcuts

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