nethttp

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: 3 Imported by: 0

Documentation

Overview

Package nethttp adapts the framework-agnostic oapi core onto the net/http standard library (Go 1.22+ method-aware ServeMux patterns). Register oapi routes with Register / RegisterAll and serve the OpenAPI document with SpecHandler.

Index

Constants

This section is empty.

Variables

View Source
var DefaultMaxRequestBytes int64 = 10 << 20 // 10 MiB

DefaultMaxRequestBytes caps how many bytes the adapter reads from a request body (JSON, urlencoded and multipart), guarding against memory/disk exhaustion from oversized uploads. Set it to 0 to disable the cap (e.g. when you enforce limits with your own middleware). Override before registering routes.

Functions

func Register

func Register(mux *http.ServeMux, route oapi.Route, native ...Middleware)

Register mounts a single oapi.Route on a ServeMux using a method-aware pattern. Optional native middlewares wrap the route handler.

func RegisterAll

func RegisterAll(mux *http.ServeMux, routes ...oapi.Route)

RegisterAll mounts every route on the mux.

func SpecHandler

func SpecHandler(reg *oapi.Registry) http.HandlerFunc

SpecHandler serves a registry's OpenAPI document as JSON, built once.

Types

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware is a standard net/http wrapping middleware.

Jump to

Keyboard shortcuts

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