Radar · Go · Archive · Week 35 · Aug 24 – 30, 2026
net/http: add MethodQuery constant
Worth knowingstdlib
- What changed
- The standard library now defines
const MethodQuery = "QUERY"innet/http/method.go. - Production impact
- The source does not say.
- Try it
- Import
net/httpand printhttp.MethodQueryto verify the new constant. - Source
- github.com/golang/go/issues/80058
Understand it, then run it
The HTTP protocol has a method called QUERY that lets a client send a large or binary request body while still keeping the request safe and idempotent. The Go standard library now defines a constant for this method: MethodQuery = "QUERY". Before this change you could not refer to the method by a predefined name; you would have to type the string yourself. With the new constant you can write http.MethodQuery instead of "QUERY".
Run it now
// This program demonstrates that http.MethodQuery is not defined in Go 1.27.1.
// It uses the literal string "QUERY" instead, which is the value that will be
// added to the standard library in a future release.
package main
import (
"fmt"
"net/http"
)
func main() {
// Use the literal method name that will become http.MethodQuery later.
req, err := http.NewRequest("QUERY", "https://example.com", nil)
if err != nil {
panic(err)
}
fmt.Println("Method:", req.Method) // prints: QUERY
}
What it printed when we ran it on Go 1.27.1
Method: QUERY
Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.
Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed