@opra/client
Version:
Opra Client package
29 lines (28 loc) • 772 B
JavaScript
import { Observable } from 'rxjs';
/**
* Base class for HTTP backends.
*
* @class HttpBackend
*/
export class HttpBackend {
/** The API document associated with this backend */
document;
/** The base URL of the service */
serviceUrl;
/** List of HTTP interceptors */
interceptors;
/**
* Creates a new instance of HttpBackend.
*
* @param serviceUrl The base URL of the service.
* @param options Configuration options.
* @protected
*/
constructor(serviceUrl, options) {
this.document = options?.document;
const u = new URL(serviceUrl);
this.serviceUrl = u.toString().split('?')[0].split('#')[0];
if (!this.serviceUrl.endsWith('/'))
this.serviceUrl += '/';
}
}