Browse Source

Fixes typings for getProxyAgent

main
Eric Amodio 2 years ago
parent
commit
2e68712353
2 changed files with 5 additions and 4 deletions
  1. +3
    -2
      src/env/browser/fetch.ts
  2. +2
    -2
      src/plus/gitlab/gitlab.ts

+ 3
- 2
src/env/browser/fetch.ts View File

@ -1,9 +1,10 @@
const fetch = globalThis.fetch; const fetch = globalThis.fetch;
export { fetch, fetch as insecureFetch }; export { fetch, fetch as insecureFetch };
import type { HttpsProxyAgent } from 'https-proxy-agent';
declare global { declare global {
interface RequestInit { interface RequestInit {
agent?: undefined;
agent?: HttpsProxyAgent | undefined;
} }
} }
@ -12,7 +13,7 @@ declare type _RequestInit = RequestInit;
declare type _Response = Response; declare type _Response = Response;
export type { _BodyInit as BodyInit, _RequestInit as RequestInit, _Response as Response }; export type { _BodyInit as BodyInit, _RequestInit as RequestInit, _Response as Response };
export function getProxyAgent(_strictSSL?: boolean): undefined {
export function getProxyAgent(_strictSSL?: boolean): HttpsProxyAgent | undefined {
return undefined; return undefined;
} }

+ 2
- 2
src/plus/gitlab/gitlab.ts View File

@ -682,7 +682,7 @@ $search: String!
rsp = await fetchMethod(`${baseUrl ?? 'https://gitlab.com/api'}/graphql`, { rsp = await fetchMethod(`${baseUrl ?? 'https://gitlab.com/api'}/graphql`, {
method: 'POST', method: 'POST',
headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' }, headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },
agent: agent as any,
agent: agent,
body: JSON.stringify({ query: query, variables: variables }), body: JSON.stringify({ query: query, variables: variables }),
}); });
@ -734,7 +734,7 @@ $search: String!
try { try {
rsp = await fetchMethod(url, { rsp = await fetchMethod(url, {
headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' }, headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },
agent: agent as any,
agent: agent,
...options, ...options,
}); });

Loading…
Cancel
Save