Skip to content

Commit 65d7362

Browse files
committed
changes
1 parent 1d45f4f commit 65d7362

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tools.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,6 @@ func getCurrentUserId(cfg config, httpClient *http.Client) (string, error) {
572572

573573
req.Header.Set("Authorization", "Bearer "+cfg.token)
574574
req.Header.Set("Accept", "application/json")
575-
req.Header.Set("X-AXIOM-ORG-ID", cfg.orgID)
576575

577576
resp, err := httpClient.Do(req)
578577
if err != nil {
@@ -589,17 +588,18 @@ func getCurrentUserId(cfg config, httpClient *http.Client) (string, error) {
589588
if err != nil {
590589
return "", fmt.Errorf("failed to read response body: %w", err)
591590
}
592-
593-
var userResponse map[string]interface{}
591+
var userResponse struct {
592+
ID string `json:"id"`
593+
}
594594
if err := json.Unmarshal(body, &userResponse); err != nil {
595595
return "", fmt.Errorf("failed to parse user response: %w", err)
596596
}
597597

598-
if userID, ok := userResponse["id"].(string); ok && userID != "" {
599-
return userID, nil
598+
if userResponse.ID == "" {
599+
return "", fmt.Errorf("user ID not found in response")
600600
}
601601

602-
return "", fmt.Errorf("user ID not found in response")
602+
return userResponse.ID, nil
603603
}
604604

605605
// newGetQueryHistoryHandler creates a handler for retrieving query execution history from axiom-history dataset

0 commit comments

Comments
 (0)