mirror of
https://github.com/gin-gonic/gin.git
synced 2026-09-04 22:53:34 +08:00
docs: fix QUERY documentation and add gin.MethodQuery example
This commit is contained in:
parent
26ec1613cb
commit
e0ae9100ca
16
docs/doc.md
16
docs/doc.md
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user