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.2 KB
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
---|
4 | exports.__esModule = true;
|
---|
5 | exports.retrievalURI = exports.httpClient = void 0;
|
---|
6 | var _index = _interopRequireDefault(require("../../http/index.js"));
|
---|
7 | const retrievalURI = options => {
|
---|
8 | var _ref, _globalThis$document;
|
---|
9 | /**
|
---|
10 | * Swagger-UI uses baseDoc instead of url, this helper function exists
|
---|
11 | * to allow both.
|
---|
12 | *
|
---|
13 | * In browser environment, we allow to pass a relative URI Reference,
|
---|
14 | * and we resolve it against the document's baseURI before passing it deeper
|
---|
15 | * to swagger-client code.
|
---|
16 | */
|
---|
17 | const {
|
---|
18 | baseDoc,
|
---|
19 | url
|
---|
20 | } = options;
|
---|
21 | const retrievalURL = (_ref = baseDoc != null ? baseDoc : url) != null ? _ref : '';
|
---|
22 | return typeof ((_globalThis$document = globalThis.document) == null ? void 0 : _globalThis$document.baseURI) === 'string' ? String(new URL(retrievalURL, globalThis.document.baseURI)) : retrievalURL;
|
---|
23 | };
|
---|
24 | exports.retrievalURI = retrievalURI;
|
---|
25 | const httpClient = options => {
|
---|
26 | const {
|
---|
27 | fetch,
|
---|
28 | http
|
---|
29 | } = options;
|
---|
30 |
|
---|
31 | // @TODO fetch should be removed, and http used instead
|
---|
32 | // provide a default fetch implementation
|
---|
33 | return fetch || http || _index.default;
|
---|
34 | };
|
---|
35 | exports.httpClient = httpClient; |
---|
Note:
See
TracBrowser
for help on using the repository browser.