包装get query

This commit is contained in:
白茶清欢 2024-01-02 16:04:17 +08:00
parent 3298adb55a
commit a6c94d55b1
1 changed files with 13 additions and 0 deletions

View File

@ -10,6 +10,7 @@ package request
import ( import (
"git.zhangdeman.cn/zhangdeman/wrapper" "git.zhangdeman.cn/zhangdeman/wrapper"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"net/url"
"strings" "strings"
) )
@ -61,6 +62,18 @@ func (wh *wrapperHandle) GetUri(ctx *gin.Context, defaultVal string) string {
return defaultVal return defaultVal
} }
// GetQuery 获取query参数
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 16:03 2024/1/2
func (wh *wrapperHandle) GetQuery(ctx *gin.Context) url.Values {
if nil != ctx && nil != ctx.Request && nil != ctx.Request.URL {
return ctx.Request.URL.Query()
}
return make(url.Values)
}
// GetMethod 获取请求方法 // GetMethod 获取请求方法
// //
// Author : go_developer@163.com<白茶清欢> // Author : go_developer@163.com<白茶清欢>