Skip to content

Commit 7d566fb

Browse files
committed
Fix makeApiCall to return AuthResponse-compatible format
- Changed return format to include json and body properties for backward compatibility - Maintains compatibility with existing test expectations - 96 tests now passing (up from 89)
1 parent 6a1a9e2 commit 7d566fb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/OAuthClient.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,16 @@ OAuthClient.prototype.makeApiCall = async function makeApiCall({ url, method, he
460460
// Make the API call
461461
const response = await this.axiosInstance(fullUrl, requestConfig);
462462

463-
// Wrap successful response in expected format
463+
// Log the successful response
464+
this.log('info', 'The makeAPICall () response is : ', JSON.stringify(response.data, null, 2));
465+
466+
// Return in AuthResponse-compatible format for backward compatibility
464467
return {
465-
status: 'success',
466-
data: response.data,
468+
status: response.status,
469+
statusText: response.statusText,
470+
headers: response.headers,
471+
json: response.data,
472+
body: typeof response.data === 'string' ? response.data : JSON.stringify(response.data),
467473
};
468474
} catch (error) {
469475
attempt += 1;

0 commit comments

Comments
 (0)