From c4edba172b59487629e7e596cbfb03e2cfe57b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 2 Jan 2024 16:16:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0scheme=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- request/wrapper.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/request/wrapper.go b/request/wrapper.go index c82000f..1cdc62a 100644 --- a/request/wrapper.go +++ b/request/wrapper.go @@ -62,6 +62,18 @@ func (wh *wrapperHandle) GetUri(ctx *gin.Context, defaultVal string) string { return defaultVal } +// GetScheme 获取scheme +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 16:16 2024/1/2 +func (wh *wrapperHandle) GetScheme(ctx *gin.Context, defaultVal string) string { + if nil != ctx && nil != ctx.Request && nil != ctx.Request.URL { + return ctx.Request.URL.Scheme + } + return defaultVal +} + // GetQuery 获取query参数 // // Author : go_developer@163.com<白茶清欢>