diff --git a/lib/util/http/gitea.ts b/lib/util/http/gitea.ts index 62defee036adf07fd3e1795c3c9079ad62e9ca56..a3305b6cc77b2d7d771633814fe841b6d3c5c3de 100644 --- a/lib/util/http/gitea.ts +++ b/lib/util/http/gitea.ts @@ -9,9 +9,8 @@ export const setBaseUrl = (newBaseUrl: string): void => { baseUrl = newBaseUrl.replace(/\/*$/, '/'); // TODO #12875 }; -export interface GiteaHttpOptions extends InternalHttpOptions { +export interface GiteaHttpOptions extends HttpOptions { paginate?: boolean; - token?: string; } function getPaginationContainer<T = unknown>(body: unknown): T[] | null { diff --git a/lib/util/http/github.ts b/lib/util/http/github.ts index 0d3a143d1cee67076e8d42c4adb4b6cb663bfdb1..45021b32d48aa73af2df45b3cb3b5e58040f5c83 100644 --- a/lib/util/http/github.ts +++ b/lib/util/http/github.ts @@ -18,6 +18,7 @@ import { parseLinkHeader } from '../url'; import type { GotLegacyError } from './legacy'; import type { GraphqlOptions, + HttpOptions, HttpPostOptions, HttpResponse, InternalHttpOptions, @@ -30,15 +31,10 @@ export const setBaseUrl = (url: string): void => { baseUrl = url; }; -interface GithubInternalOptions extends InternalHttpOptions { - body?: string; -} - -export interface GithubHttpOptions extends InternalHttpOptions { +export interface GithubHttpOptions extends HttpOptions { paginate?: boolean | string; paginationField?: string; pageLimit?: number; - token?: string; } interface GithubGraphqlRepoData<T = unknown> { @@ -274,7 +270,7 @@ export class GithubHttp extends Http<GithubHttpOptions, GithubHttpOptions> { protected override async request<T>( url: string | URL, - options?: GithubInternalOptions & GithubHttpOptions, + options?: InternalHttpOptions & GithubHttpOptions, okToRetry = true ): Promise<HttpResponse<T>> { const opts = { diff --git a/lib/util/http/gitlab.ts b/lib/util/http/gitlab.ts index b1487476c1cd3c972b6626e16d09b6344bc774cf..cd43052b378138bff7d022e26dd29d0273a33093 100644 --- a/lib/util/http/gitlab.ts +++ b/lib/util/http/gitlab.ts @@ -3,7 +3,7 @@ import { PlatformId } from '../../constants'; import { logger } from '../../logger'; import { ExternalHostError } from '../../types/errors/external-host-error'; import { parseLinkHeader, parseUrl } from '../url'; -import type { HttpResponse, InternalHttpOptions } from './types'; +import type { HttpOptions, HttpResponse, InternalHttpOptions } from './types'; import { Http } from '.'; let baseUrl = 'https://gitlab.com/api/v4/'; @@ -11,13 +11,8 @@ export const setBaseUrl = (url: string): void => { baseUrl = url; }; -interface GitlabInternalOptions extends InternalHttpOptions { - body?: string; -} - -export interface GitlabHttpOptions extends InternalHttpOptions { +export interface GitlabHttpOptions extends HttpOptions { paginate?: boolean; - token?: string; } export class GitlabHttp extends Http<GitlabHttpOptions, GitlabHttpOptions> { @@ -27,7 +22,7 @@ export class GitlabHttp extends Http<GitlabHttpOptions, GitlabHttpOptions> { protected override async request<T>( url: string | URL, - options?: GitlabInternalOptions & GitlabHttpOptions + options?: InternalHttpOptions & GitlabHttpOptions ): Promise<HttpResponse<T>> { const opts = { baseUrl, diff --git a/lib/util/http/types.ts b/lib/util/http/types.ts index 7e9a4302ad74ddb32ecadb870572d18e5c39beea..5fe79a1c2fe854c4831018cd69b0bc873345a78b 100644 --- a/lib/util/http/types.ts +++ b/lib/util/http/types.ts @@ -60,6 +60,8 @@ export interface HttpOptions { noAuth?: boolean; throwHttpErrors?: boolean; + + token?: string; useCache?: boolean; }