From 37fa83aa9b66aef68047890c5a17b07c1f3220d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=85=89=E6=98=A5?= Date: Mon, 5 Sep 2022 09:21:00 +0800 Subject: [PATCH] - add request UserAgent --- const.go | 2 +- request.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/const.go b/const.go index cee4871..a64cf13 100644 --- a/const.go +++ b/const.go @@ -14,7 +14,7 @@ const ( // SDK 相关信息 const ( - Version = "1.0.12" // SDK 版本 + Version = "1.0.13" // SDK 版本 UserAgentFormat = "WechatPay-Go/%s (%s) GO/%s" // UserAgent中的信息 ) diff --git a/request.go b/request.go index 9b69851..f2b8047 100644 --- a/request.go +++ b/request.go @@ -28,6 +28,9 @@ func (c *Client) request(ctx context.Context, url string, params map[string]inte // 设置参数 client.SetParams(params) + // 设置用户代理 + client.SetUserAgent(gorequest.GetRandomUserAgentSystem()) + // 设置头部 client.SetHeader("Authorization", authorization) client.SetHeader("Accept", "application/json")