| @@ -257,8 +257,6 @@ func buildReqTmpQr(val, expire int32) *http.Request { | |||
| return req | |||
| } | |||
| func buildReqCommonHeader(r *http.Request) { | |||
| // | |||
| // example request | |||
| @@ -285,3 +283,13 @@ func buildReqCommonHeader(r *http.Request) { | |||
| r.Header.Set("X-Forwarded-Server", "wechat.hitxy.org.au") | |||
| } | |||
| func TestBuildQueryString(t *testing.T) { | |||
| url := "http://www.hitxy.org.au/crmcache?a=abc" | |||
| newURL := buildSignatureAppend2Url(url, IntraAPIConfig.CRMSecrete) | |||
| //log.Println(newURL) | |||
| AssertEqual(t, url != newURL, true, "URL append signature should be correct") | |||
| req, err := http.NewRequest("GET", newURL, nil) | |||
| AssertEqual(t, err, nil, "pase new URL should be correct") | |||
| AssertEqual(t, checkSignatureByToken(req, IntraAPIConfig.CRMSecrete), true, "check signature shold be correct") | |||
| } | |||