connected-to-google
This commit is contained in:
@@ -45,17 +45,25 @@ type Response struct {
|
||||
}
|
||||
|
||||
// ForwardRequest forwards a request to Google Healthcare API
|
||||
func (c *Client) ForwardRequest(ctx context.Context, method, requestType, path string, headers map[string]string, body []byte) (*Response, error) {
|
||||
// Get access token
|
||||
func (c *Client) ForwardRequest(ctx context.Context, method, path string, headers map[string]string, body []byte) (*Response, error) {
|
||||
token, err := c.googleAuth.GetAccessToken()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get access token: %w", err)
|
||||
}
|
||||
|
||||
// Build URL
|
||||
// Build URL - Simplified to exactly match OHIF's expected structure
|
||||
baseURL := fmt.Sprintf("https://healthcare.googleapis.com/v1/projects/%s/locations/%s/datasets/%s/dicomStores/%s/dicomWeb",
|
||||
c.projectID, c.location, c.dataset, c.dicomStore)
|
||||
fullURL := fmt.Sprintf("%s/%s%s", baseURL, requestType, path)
|
||||
|
||||
// Ensure path starts with /
|
||||
if len(path) > 0 && path[0] != '/' {
|
||||
path = "/" + path
|
||||
}
|
||||
|
||||
fullURL := baseURL + path
|
||||
|
||||
// Log the full URL for debugging
|
||||
fmt.Printf("Requesting URL: %s\n", fullURL)
|
||||
|
||||
// Create request
|
||||
req, err := http.NewRequestWithContext(ctx, method, fullURL, bytes.NewReader(body))
|
||||
|
||||
Reference in New Issue
Block a user