Skip to content

Commit

Permalink
rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
Ceelog committed Aug 18, 2020
1 parent ef9ffe6 commit d41d270
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (client *Client) HTTPPost(uri string, payload io.Reader, header http.Header
req.Header = header

if client.Ctx.Logger != nil {
client.Ctx.Logger.Printf("GET %s Headers %v", req.URL.String(), req.Header)
client.Ctx.Logger.Printf("POST %s Headers %v", req.URL.String(), req.Header)
}
response, err := httpClient.Do(req)
if err != nil {
Expand Down
9 changes: 7 additions & 2 deletions feishu.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func newApp(config AppConfig) (app *App) {
}

/*
SetTenantAccessTokenCacheDriver 设置 TenantAccessToken 缓存器 默认为文件缓存:目录 os.TempDir()
SetCacheDriver 设置 access_token 缓存器 默认为文件缓存:目录 os.TempDir()
驱动接口类型 为 cachego.Cache
*/
Expand All @@ -78,14 +78,19 @@ func (app *App) SetCacheDriver(driver cachego.Cache) {
}

/*
SetGetTenantAccessTokenHandler 设置 TenantAccessToken 获取方法。默认 从本地缓存获取(过期从微信接口刷新
SetGetTenantAccessTokenHandler 设置 TenantAccessToken 获取方法。默认 从本地缓存获取(过期从接口刷新
如果有多实例服务,可以设置为 Redis 或 RPC 等中控服务器 获取 就可以避免 TenantAccessToken 刷新冲突
*/
func (app *App) SetGetTenantAccessTokenHandler(f GetTenantAccessTokenFunc) {
app.GetTenantAccessTokenHandler = f
}

/*
SetGetAppAccessTokenHandler 设置 AppAccessToken 获取方法。默认 从本地缓存获取(过期从接口刷新)
如果有多实例服务,可以设置为 Redis 或 RPC 等中控服务器 获取 就可以避免 TenantAccessToken 刷新冲突
*/
func (app *App) SetGetAppAccessTokenHandler(f GetAppAccessTokenFunc) {
app.GetAppAccessTokenHandler = f
}
Expand Down
4 changes: 2 additions & 2 deletions test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package test 模拟微信服务器 测试
// Package test 模拟服务器 测试
package test

import (
Expand Down Expand Up @@ -42,7 +42,7 @@ func Setup() {
// Mock Server
MockSvrHandler = http.NewServeMux()
MockSvr = httptest.NewServer(MockSvrHandler)
feishu.FeishuServerUrl = MockSvr.URL // 拦截发往微信服务器的请求
feishu.FeishuServerUrl = MockSvr.URL // 拦截发往服务器的请求

// Mock access token
MockSvrHandler.HandleFunc("/open-apis/auth/v3/tenant_access_token/internal/", func(w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit d41d270

Please sign in to comment.