http

package
v2.303.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package http provides debug HTTP routing helpers for go-service.

This package provides a small wrapper around go-service's `net/http` primitives to build a dedicated debug endpoint router. Other debug subpackages (for example `debug/pprof`, `debug/fgprof`, `debug/statsviz`, and `debug/psutil`) register their handlers on the mux returned by `NewServeMux`.

Routing conventions

Handlers are typically registered using `Pattern`, which prefixes the provided route pattern with the service name to form a stable debug route namespace.

Start with `ServeMux`, `NewServeMux`, and `Pattern`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pattern added in v2.61.0

func Pattern(name env.Name, pattern string) string

Pattern builds a debug route pattern for name and pattern.

This is a thin wrapper around `net/http.Pattern`, which prefixes the provided pattern with the service name to form routes like:

/<name><pattern>

Example:

Pattern(name, "/debug/pprof/") // -> "/my-service/debug/pprof/"

Types

type ServeMux

type ServeMux struct {
	*http.ServeMux
}

ServeMux wraps `net/http.ServeMux` for debug routing.

It exists primarily to provide a stable type that can be injected via DI as "the debug mux".

func NewServeMux

func NewServeMux() *ServeMux

NewServeMux constructs a new debug ServeMux.

The returned mux is a small wrapper over go-service's `net/http.ServeMux` and is intended as the shared router where debug subpackages register their handlers (pprof, fgprof, statsviz, psutil, etc.).

Jump to

Keyboard shortcuts

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