source: node_modules/swagger-client/es/resolver/utils/options.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1import Http from '../../http/index.js';
2export const retrievalURI = options => {
3 var _ref, _globalThis$document;
4 /**
5 * Swagger-UI uses baseDoc instead of url, this helper function exists
6 * to allow both.
7 *
8 * In browser environment, we allow to pass a relative URI Reference,
9 * and we resolve it against the document's baseURI before passing it deeper
10 * to swagger-client code.
11 */
12 const {
13 baseDoc,
14 url
15 } = options;
16 const retrievalURL = (_ref = baseDoc !== null && baseDoc !== void 0 ? baseDoc : url) !== null && _ref !== void 0 ? _ref : '';
17 return typeof ((_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.baseURI) === 'string' ? String(new URL(retrievalURL, globalThis.document.baseURI)) : retrievalURL;
18};
19export const httpClient = options => {
20 const {
21 fetch,
22 http
23 } = options;
24
25 // @TODO fetch should be removed, and http used instead
26 // provide a default fetch implementation
27 return fetch || http || Http;
28};
Note: See TracBrowser for help on using the repository browser.