mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
Refactor API calls to use unified request structure
- Updated MicrosoftTeams and Slack classes to use the new API.post structure with url and data properties. - Refactored API utility methods to accept a single options object for HTTP requests, improving consistency across the codebase. - Modified various service and utility classes (e.g., CopilotPullRequestService, CodeRepositoryUtil, and ApiMonitor) to align with the new API request format. - Enhanced error handling and logging for API responses. - Updated tests to accommodate changes in API method signatures.
This commit is contained in:
@@ -38,14 +38,13 @@ router.get(
|
||||
const requestBody: JSONObject = ProbeAPIRequest.getDefaultRequestBody();
|
||||
|
||||
const result: HTTPResponse<JSONObject> | HTTPErrorResponse =
|
||||
await API.fetch<JSONObject>(
|
||||
HTTPMethod.POST,
|
||||
queueSizeUrl,
|
||||
requestBody,
|
||||
{},
|
||||
undefined,
|
||||
{ ...ProxyConfig.getRequestProxyAgents() },
|
||||
);
|
||||
await API.fetch<JSONObject>({
|
||||
method: HTTPMethod.POST,
|
||||
url: queueSizeUrl,
|
||||
data: requestBody,
|
||||
headers: {},
|
||||
options: { ...ProxyConfig.getRequestProxyAgents() },
|
||||
});
|
||||
|
||||
if (result instanceof HTTPErrorResponse) {
|
||||
logger.error("Error fetching queue size from ProbeIngest API");
|
||||
|
||||
Reference in New Issue
Block a user