web

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: CC0-1.0 Imports: 5 Imported by: 0

Documentation

Overview

Package web is a simple collection of high-level error and transport types that I end up using over and over.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewError

func NewError(wantStatusCode int, resp *http.Response) error

NewError creates an Error based on an expected HTTP status code vs data populated from an HTTP response.

This consumes the body of the HTTP response.

Types

type Error

type Error struct {
	WantStatus, GotStatus int
	URL                   *url.URL
	Method                string
	ResponseBody          string
}

Error is a web response error. Use this when API calls don't work out like you wanted them to.

func (Error) Error

func (e Error) Error() string

func (Error) LogValue added in v1.7.0

func (e Error) LogValue() slog.Value

LogValue formats this Error for slog.

Directories

Path Synopsis
Package alpinejs contains an embedded copy of alpine.js for responsive web apps.
Package alpinejs contains an embedded copy of alpine.js for responsive web apps.
Package cryptocompare fetches the latest USD price of a given crpytocurrency from CryptoCompare
Package cryptocompare fetches the latest USD price of a given crpytocurrency from CryptoCompare
Package discordwebhook is a simple low-level HTTP client wrapper around Discord webhooks.
Package discordwebhook is a simple low-level HTTP client wrapper around Discord webhooks.
fly
flymachines
Package flymachines is an API client for Fly's machines API.
Package flymachines is an API client for Fly's machines API.
Package marginalia implements the Marginalia search API.
Package marginalia implements the Marginalia search API.
Package mastodon is an API client for Mastodon[1], specifically designed for making bots.
Package mastodon is an API client for Mastodon[1], specifically designed for making bots.
Package mastosan takes Mastodon flavored HTML and emits Slack-flavored markdown.
Package mastosan takes Mastodon flavored HTML and emits Slack-flavored markdown.
middleware
authctx
Package authctx holds the canonical context keys for the verified caller, shared by the sigv4 and sigv4a middleware families (and their iamsts sub-packages) so identity stored by either family is readable through either — and directly through this package, which new code should prefer.
Package authctx holds the canonical context keys for the verified caller, shared by the sigv4 and sigv4a middleware families (and their iamsts sub-packages) so identity stored by either family is readable through either — and directly through this package, which new code should prefer.
internal/awssig
Package awssig holds the algorithm-independent internals shared by the SigV4 (web/middleware/sigv4) and SigV4A (web/middleware/sigv4a) middlewares: canonical-request construction, payload-hash resolution, and the constants both schemes define identically.
Package awssig holds the algorithm-independent internals shared by the SigV4 (web/middleware/sigv4) and SigV4A (web/middleware/sigv4a) middlewares: canonical-request construction, payload-hash resolution, and the constants both schemes define identically.
sigv4
Package sigv4 verifies incoming HTTP requests that were signed with AWS Signature Version 4 (the AWS4-HMAC-SHA256 scheme).
Package sigv4 verifies incoming HTTP requests that were signed with AWS Signature Version 4 (the AWS4-HMAC-SHA256 scheme).
sigv4/iamsts
Package iamsts authenticates HTTP requests signed with AWS Signature Version 4 by verifying them locally against a cached derived signing key fetched from IAM's SigningKeyService.
Package iamsts authenticates HTTP requests signed with AWS Signature Version 4 by verifying them locally against a cached derived signing key fetched from IAM's SigningKeyService.
sigv4a
Package sigv4a signs and verifies HTTP requests with AWS Signature Version 4A (the AWS4-ECDSA-P256-SHA256 scheme): the same canonical-request construction as classic SigV4 (shared via web/middleware/internal/awssig), but signed with an ECDSA P-256 key derived deterministically from the credential instead of an HMAC key.
Package sigv4a signs and verifies HTTP requests with AWS Signature Version 4A (the AWS4-ECDSA-P256-SHA256 scheme): the same canonical-request construction as classic SigV4 (shared via web/middleware/internal/awssig), but signed with an ECDSA P-256 key derived deterministically from the credential instead of an HMAC key.
sigv4a/iamsts
Package iamsts authenticates HTTP requests signed with AWS Signature Version 4A by verifying them locally against a cached ECDSA public key fetched from IAM's key service.
Package iamsts authenticates HTTP requests signed with AWS Signature Version 4A by verifying them locally against a cached ECDSA public key fetched from IAM's key service.
sigv4a/sigv4aclient
Package sigv4aclient provides an http.RoundTripper that signs outgoing requests with AWS Signature Version 4A. It is the SigV4A counterpart to web/middleware/sigv4/sigv4client (which signs classic SigV4 for real AWS services): use this package for within.website services verified by web/middleware/sigv4a.
Package sigv4aclient provides an http.RoundTripper that signs outgoing requests with AWS Signature Version 4A. It is the SigV4A counterpart to web/middleware/sigv4/sigv4client (which signs classic SigV4 for real AWS services): use this package for within.website services verified by web/middleware/sigv4a.
sigv4any
Package sigv4any authenticates HTTP requests signed with either classic AWS Signature Version 4 (web/middleware/sigv4) or Signature Version 4A (web/middleware/sigv4a), dispatching per request on the Authorization header's algorithm token.
Package sigv4any authenticates HTTP requests signed with either classic AWS Signature Version 4 (web/middleware/sigv4) or Signature Version 4A (web/middleware/sigv4a), dispatching per request on the Authorization header's algorithm token.
Package nodeinfo contains types and a simple client for reading the standard NodeInfo protocol described by Diaspora[1].
Package nodeinfo contains types and a simple client for reading the standard NodeInfo protocol described by Diaspora[1].
chatgpt
Package chatgpt is a simple binding to the ChatGPT API.
Package chatgpt is a simple binding to the ChatGPT API.
Package pocketid provides a Go client for interacting with the PocketID API.
Package pocketid provides a Go client for interacting with the PocketID API.
Package stablediffusion provides a simple API client for the Automatic1111 Stable Diffusion web UI.
Package stablediffusion provides a simple API client for the Automatic1111 Stable Diffusion web UI.
Package switchcounter is a simple interface to the https://www.switchcounter.science/ API.
Package switchcounter is a simple interface to the https://www.switchcounter.science/ API.
Package tokipana wraps http://inamidst.com/services/tokipana.
Package tokipana wraps http://inamidst.com/services/tokipana.
Package tokiponatokens is a wrapper to a Toki Poka tokenizer.
Package tokiponatokens is a wrapper to a Toki Poka tokenizer.
Package vanity implements custom import paths (Go vanity URLs) as an HTTP handler that can be installed at the vanity URL.
Package vanity implements custom import paths (Go vanity URLs) as an HTTP handler that can be installed at the vanity URL.

Jump to

Keyboard shortcuts

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