2022-07-03 00:56:37 +08:00
|
|
|
// Package request ...
|
|
|
|
//
|
|
|
|
// Description : request ...
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 2022-07-03 00:52
|
|
|
|
package request
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
// contentType 请求类型相关处理
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 00:53 2022/7/3
|
|
|
|
type contentType struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsJson 请求方式是否为JSON
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 00:35 2022/7/3
|
|
|
|
func (ct *contentType) IsJson(ctx *gin.Context) bool {
|
2023-12-29 15:29:37 +08:00
|
|
|
return strings.Contains(WrapperHandle.GetContentType(ctx, "application/x-www-form-urlencoded"), "json")
|
2022-07-03 00:56:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsFormURLEncoded 请求方式是否为 x-www-form-urlencoded
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 00:36 2022/7/3
|
|
|
|
func (ct *contentType) IsFormURLEncoded(ctx *gin.Context) bool {
|
2023-12-29 15:29:37 +08:00
|
|
|
return strings.Contains(WrapperHandle.GetContentType(ctx, "application/x-www-form-urlencoded"), "x-www-form-urlencoded")
|
2022-07-03 00:56:37 +08:00
|
|
|
}
|