docs: fix QUERY documentation and add gin.MethodQuery example

This commit is contained in:
Aum Patel 2026-07-07 08:31:34 +05:30
parent 26ec1613cb
commit e0ae9100ca

View File

@ -7,6 +7,7 @@
- [Build without MsgPack rendering feature](#build-without-msgpack-rendering-feature)
- [Routing](#routing)
- [Using GET, POST, PUT, PATCH, QUERY, DELETE and OPTIONS](#using-get-post-put-patch-delete-query-and-options)
- [QUERY Method (RFC 10008)](#query-method-rfc-10008)
- [Parameters in path](#parameters-in-path)
- [Querystring parameters](#querystring-parameters)
- [Multipart/Urlencoded Form](#multiparturlencoded-form)
@ -127,7 +128,7 @@ func main() {
router.PUT("/somePut", putting)
router.DELETE("/someDelete", deleting)
router.PATCH("/somePatch", patching)
router.QUERY("/somePatch", querying)
router.QUERY("/someQuery", querying)
router.HEAD("/someHead", head)
router.OPTIONS("/someOptions", options)
@ -137,6 +138,19 @@ func main() {
// router.Run(":3000") for a hard coded port
}
```
### QUERY Method (RFC 10008)
Gin supports the HTTP `QUERY` method defined by RFC 10008.
```go
router.QUERY("/search", querying)
```
The exported `gin.MethodQuery` constant can be used wherever an HTTP method is required, such as when constructing requests:
```go
req := httptest.NewRequest(gin.MethodQuery, "/query", nil)
```
### Parameters in path