renovate/lib/util/http/bitbucket.ts
2020-07-22 07:45:57 +02:00

25 lines
643 B
TypeScript

import { URL } from 'url';
import { PLATFORM_TYPE_BITBUCKET } from '../../constants/platforms';
import { Http, HttpOptions, HttpResponse, InternalHttpOptions } from '.';
let baseUrl = 'https://api.bitbucket.org/';
export const setBaseUrl = (url: string): void => {
baseUrl = url;
};
export class BitbucketHttp extends Http {
constructor(options?: HttpOptions) {
super(PLATFORM_TYPE_BITBUCKET, options);
}
protected request<T>(
url: string | URL,
options?: InternalHttpOptions
): Promise<HttpResponse<T> | null> {
const opts = {
baseUrl,
...options,
};
return super.request<T>(url, opts);
}
}