mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-08-14 16:25:44 +00:00
fix(gold): use GET for VNAppMob key refresh endpoint
VNAppMob /api/request_api_key returns 405 for POST and accepts GET.
This commit is contained in:
@@ -212,7 +212,7 @@ func (c *VNAppMobClient) refreshKeyLocked(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint, nil)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("vnappmob: build refresh request: %w", err)
|
||||
}
|
||||
|
||||
@@ -100,8 +100,8 @@ func TestRefreshKey(t *testing.T) {
|
||||
exp := time.Unix(1000, 0).Add(14 * 24 * time.Hour).Unix()
|
||||
var refreshHits int32
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodPost {
|
||||
t.Errorf("refresh: want POST, got %s", r.Method)
|
||||
if r.Method != http.MethodGet {
|
||||
t.Errorf("refresh: want GET, got %s", r.Method)
|
||||
}
|
||||
if !strings.HasSuffix(r.URL.Path, "/api/request_api_key") {
|
||||
t.Errorf("refresh path: got %s", r.URL.Path)
|
||||
|
||||
Reference in New Issue
Block a user