mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-14 16:46:25 +00:00
b121deb969
* refactor:util/http move interfaces and types from index.ts to types.ts * refactor:reorder imports * refactor:move HttpError from type.ts to index.ts * refactor:change imports after moving HttpError from type.ts to index.ts * refactor:revert white spaces * refactor:revert moving httpError from types.ts to index.ts * refactor: moving httpError from types.ts to index.ts * refactor: change import * refactor: change import * refactor: change import * refactor: fix circular dependencies (lint build) Co-authored-by: Michael Kriese <michael.kriese@visualon.de> Co-authored-by: Rhys Arkins <rhys@arkins.net>
31 lines
785 B
TypeScript
31 lines
785 B
TypeScript
import { PlatformId } from '../../constants';
|
|
import { resolveBaseUrl } from '../url';
|
|
import type { HttpOptions, HttpResponse, InternalHttpOptions } from './types';
|
|
import { Http } from '.';
|
|
|
|
let baseUrl: string;
|
|
export const setBaseUrl = (url: string): void => {
|
|
baseUrl = url;
|
|
};
|
|
|
|
export class BitbucketServerHttp extends Http {
|
|
constructor(options?: HttpOptions) {
|
|
super(PlatformId.BitbucketServer, options);
|
|
}
|
|
|
|
protected override request<T>(
|
|
path: string,
|
|
options?: InternalHttpOptions
|
|
): Promise<HttpResponse<T>> {
|
|
const url = resolveBaseUrl(baseUrl, path);
|
|
const opts = {
|
|
baseUrl,
|
|
...options,
|
|
};
|
|
opts.headers = {
|
|
...opts.headers,
|
|
'X-Atlassian-Token': 'no-check',
|
|
};
|
|
return super.request<T>(url, opts);
|
|
}
|
|
}
|