bodycap

package
v1.0.0-dev.19 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package bodycap caps every response body an http.Client reads at MaxBytes, whatever length the response declares.

Index

Constants

View Source
const MaxBytes = 1 << 20

MaxBytes is the most a capped body hands out.

Variables

View Source
var ErrTooLarge = errors.New("oidc: response body larger than 1 MiB")

ErrTooLarge is the error a capped body fails with once it holds a byte past MaxBytes.

Functions

This section is empty.

Types

type Transport

type Transport struct{ Next http.RoundTripper }

Transport caps the response body, not the dial, so it sits outside an SSRF-guarding transport without weakening it.

func (Transport) RoundTrip

func (t Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip answers Next's response with its body capped.

Jump to

Keyboard shortcuts

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