net/http
std
HTTP handlers and routing in the Go standard library
Reviewed 2026-09-30 · Package source
Recorded facts
Metadata fetched: 2026-09-30T18:11:37.637Z · Freshness: current. This is a dated snapshot; check the linked sources before adopting a package.
- Version
- go1.27.1
- Minimum Go version
- 1.22
- Licenses
- BSD-3-Clause
- Import path
- net/http
- Capabilities
- routing
- Dependencies recorded
- 0
Vulnerability evidence
Status: unknown. Checked: Unknown.
Vulnerability evidence is unavailable; absence of data does not mean no vulnerabilities.
Version advisories do not establish whether a vulnerability is reachable in your application.
Tradeoffs
- Advanced middleware conventions require application code.
Install and import
Included in the Go standard library; no dependency installation is needed.
import "net/http"
Authored example
Verification status: passed · Checked: 2026-09-30T18:16:07.641Z
Package version: go1.27.1 · Go toolchain: go1.27.1
Targets: linux/amd64, windows/amd64 · CGO: disabled
Compilation checks only this displayed example. It does not verify runtime behavior, all package features or vulnerability reachability.
package main
import (
"fmt"
"net/http"
"net/http/httptest"
)
func main() {
mux := http.NewServeMux()
mux.HandleFunc("GET /hello", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "hello")
})
response := httptest.NewRecorder()
mux.ServeHTTP(response, httptest.NewRequest(http.MethodGet, "/hello", nil))
fmt.Print(response.Body.String())
}
Compile verification covers this example only. It does not test runtime behavior or every optional feature.
Reproduce the compilation with pinned dependencies
Save the example as main.go alongside these files in a new directory. Use the recorded Go toolchain and CGO_ENABLED=0 to compile for a recorded target.
go.mod
module example.com/discovery/stdlib-http
go 1.27.1