konfig-axios-fetch-adapter
Version:
Fetch adapter for axios written in TypeScript
24 lines • 1.03 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const isAbsoluteURL_1 = __importDefault(require("../helpers/isAbsoluteURL"));
const combineURLs_1 = __importDefault(require("../helpers/combineURLs"));
/**
* Creates a new URL by combining the baseURL with the requestedURL,
* only when the requestedURL is not already an absolute URL.
* If the requestURL is absolute, this function returns the requestedURL untouched.
*
* @param {string} baseURL The base URL
* @param {string} requestedURL Absolute or relative URL to combine
* @returns {string} The combined full path
*/
function buildFullPath(baseURL, requestedURL) {
if (baseURL && !(0, isAbsoluteURL_1.default)(requestedURL)) {
return (0, combineURLs_1.default)(baseURL, requestedURL);
}
return requestedURL;
}
exports.default = buildFullPath;
//# sourceMappingURL=buildFullPath.js.map