Standard library / net/http/httptest
httptest.DefaultRemoteAddr
Historical constant with value 1.2.3.4. In Go 1.23.2 NewRequest instead sets RemoteAddr to 192.0.2.1:1234; do not assume this constant describes that request. Expected stdout: '1.2.3.4 192.0.2.1:1234\n'.
Formal Syntax & Structure
go syntaxgo
const DefaultRemoteAddr = "1.2.3.4"Working Example
Example Snippetgo
package main
import ( "fmt" "net/http/httptest")
func main() { fmt.Println(httptest.DefaultRemoteAddr, httptest.NewRequest("GET", "/", nil).RemoteAddr) }
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}