41 lines
		
	
	
		
			959 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			959 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // 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 {
 | |
| 	return strings.Contains(WrapperHandle.GetContentType(ctx, "application/x-www-form-urlencoded"), "json")
 | |
| }
 | |
| 
 | |
| // IsFormURLEncoded 请求方式是否为 x-www-form-urlencoded
 | |
| //
 | |
| // Author : go_developer@163.com<白茶清欢>
 | |
| //
 | |
| // Date : 00:36 2022/7/3
 | |
| func (ct *contentType) IsFormURLEncoded(ctx *gin.Context) bool {
 | |
| 	return strings.Contains(WrapperHandle.GetContentType(ctx, "application/x-www-form-urlencoded"), "x-www-form-urlencoded")
 | |
| }
 |