From c739ea1655f28c90ec61ab2b2f3ae63d536f3a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 20 May 2020 17:32:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95reqeust?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/jdshopapi/store_page.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platformapi/jdshopapi/store_page.go b/platformapi/jdshopapi/store_page.go index c5177229..aaa70aba 100644 --- a/platformapi/jdshopapi/store_page.go +++ b/platformapi/jdshopapi/store_page.go @@ -21,12 +21,13 @@ func (a *API) AccessStorePage(fullURL string, bizParams map[string]interface{}, if isPost { request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(utils.Map2URLValues(bizParams).Encode())) request.Header.Set("Content-Type", "application/x-www-form-urlencoded") + } else { + request, _ = http.NewRequest(http.MethodGet, utils.GenerateGetURL(fullURL, "", bizParams), nil) request.Header.Set("accept", "application/json, text/plain, */*") request.Header.Set("accept-encoding", "gzip, deflate, br") request.Header.Set("accept-language", "zh-CN,zh;q=0.9") request.Header.Set("referer", "https://stores.shop.jd.com/") - } else { - request, _ = http.NewRequest(http.MethodGet, utils.GenerateGetURL(fullURL, "", bizParams), nil) + request.Header.Set("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36") } a.FillRequestCookies(request) return request