feat(weixin_ilink): 扫码协议与腾讯官方对齐——POST local_token_list + iLink-App-Id/ClientVersion 头 + need_verifycode/redirect 状态机
This commit is contained in:
1 parent
bef398d47a
commit
f5950e4bde
9 files changed
+508
-99
No files matched your search
@@ -30,13 +30,15 @@ type reqRecorder struct {
|
||||
|
||||
// recordedReq is a normalized snapshot of an inbound HTTP request.
|
||||
type recordedReq struct {
|
||||
method string
|
||||
path string
|
||||
query string
|
||||
body []byte
|
||||
auth string
|
||||
authType string
|
||||
uin string
|
||||
method string
|
||||
path string
|
||||
query string
|
||||
body []byte
|
||||
auth string
|
||||
authType string
|
||||
uin string
|
||||
appID string
|
||||
appClientVer string
|
||||
}
|
||||
|
||||
func (r *reqRecorder) add(req recordedReq) {
|
||||
@@ -102,13 +104,15 @@ func newJSONServer(t *testing.T, rec *reqRecorder, fn func(r recordedReq) handle
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
body, _ := io.ReadAll(r.Body)
|
||||
req := recordedReq{
|
||||
method: r.Method,
|
||||
path: r.URL.Path,
|
||||
query: r.URL.RawQuery,
|
||||
body: body,
|
||||
auth: r.Header.Get("Authorization"),
|
||||
authType: r.Header.Get("AuthorizationType"),
|
||||
uin: r.Header.Get("X-WECHAT-UIN"),
|
||||
method: r.Method,
|
||||
path: r.URL.Path,
|
||||
query: r.URL.RawQuery,
|
||||
body: body,
|
||||
auth: r.Header.Get("Authorization"),
|
||||
authType: r.Header.Get("AuthorizationType"),
|
||||
uin: r.Header.Get("X-WECHAT-UIN"),
|
||||
appID: r.Header.Get("iLink-App-Id"),
|
||||
appClientVer: r.Header.Get("iLink-App-ClientVersion"),
|
||||
}
|
||||
if rec != nil {
|
||||
rec.add(req)
|
||||
|
||||
Reference in new issue
Block a user