mirror of
https://github.com/gin-gonic/gin.git
synced 2026-10-28 11:04:42 +08:00
* feat: add support for the HTTP QUERY method (RFC 10008)
Add a QUERY shortcut on RouterGroup, a gin.MethodQuery constant and a
gin.IQueryRoutes interface for callers that only hold an IRoutes value.
QUERY is deliberately kept out of IRoutes and out of Any:
- Adding a method to IRoutes would break every type outside of Gin that
implements it, such as test doubles and wrappers.
- Leaving Any untouched keeps existing catch-all routes matching exactly
the methods they matched before. Match([]string{gin.MethodQuery, ...})
covers the case where QUERY is wanted alongside other methods.
MethodQuery is declared in Gin because the standard library does not
provide http.MethodQuery yet. The value stays correct once it does.
Ref #4721
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(router): remove duplicate QUERY method
- Consolidate QUERY into the existing router method after merging master
- Preserve the MethodQuery constant and request body documentation
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Gin Default Server
This is API experiment for Gin.
package main
import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/ginS"
)
func main() {
ginS.GET("/", func(c *gin.Context) { c.String(200, "Hello World") })
ginS.Run()
}