Skip to content

Commit bd7a881

Browse files
committed
refactor: remove ca type workaround now that socket-lib 5.11.2 is published
1 parent 68cc264 commit bd7a881

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

  • packages/cli/src/utils/socket

packages/cli/src/utils/socket/api.mts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { isNonEmptyString } from '@socketsecurity/lib/strings'
3030

3131
import { getDefaultApiToken, getExtraCaCerts } from './sdk.mts'
3232

33-
import type { HttpRequestOptions as BaseHttpRequestOptions, HttpResponse } from '@socketsecurity/lib/http-request'
33+
import type { HttpRequestOptions, HttpResponse } from '@socketsecurity/lib/http-request'
3434
import { CONFIG_KEY_API_BASE_URL } from '../../constants/config.mts'
3535
import {
3636
HTTP_STATUS_BAD_REQUEST,
@@ -70,24 +70,14 @@ const logger = getDefaultLogger()
7070

7171
const NO_ERROR_MESSAGE = 'No error message returned'
7272

73-
// Extended options that include CA cert support (pending upstream in socket-lib).
74-
type HttpRequestOptions = BaseHttpRequestOptions & {
75-
ca?: string[] | undefined
76-
}
77-
7873
// Wraps httpRequest with extra CA certificates from SSL_CERT_FILE.
79-
// Once socket-lib publishes `ca` support in HttpRequestOptions, the
80-
// cast below can be removed.
8174
export async function socketHttpRequest(
8275
url: string,
8376
options?: HttpRequestOptions | undefined,
8477
): Promise<HttpResponse> {
8578
const ca = getExtraCaCerts()
8679
if (ca) {
87-
return await httpRequest(url, {
88-
...(options ?? {}),
89-
ca,
90-
} as BaseHttpRequestOptions)
80+
return await httpRequest(url, { ...(options ?? {}), ca })
9181
}
9282
return await httpRequest(url, options)
9383
}

0 commit comments

Comments
 (0)