mirror of
https://github.com/axios/axios.git
synced 2026-04-12 02:31:57 +08:00
* allowAbsoluteUrls * fix logic - copied from v1.x * update string * undo changes to dist/axios.js * chore: use strict equal in lib/core/buildFullPath.js --------- Co-authored-by: Jay <jasonsaayman@gmail.com>
24 lines
860 B
JavaScript
24 lines
860 B
JavaScript
'use strict';
|
|
|
|
var isAbsoluteURL = require('../helpers/isAbsoluteURL');
|
|
var combineURLs = 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
|
|
* @param {boolean} allowAbsoluteUrls Set to true to allow absolute URLs
|
|
*
|
|
* @returns {string} The combined full path
|
|
*/
|
|
module.exports = function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
var isRelativeURL = !isAbsoluteURL(requestedURL);
|
|
if (baseURL && (isRelativeURL || allowAbsoluteUrls === false)) {
|
|
return combineURLs(baseURL, requestedURL);
|
|
}
|
|
return requestedURL;
|
|
};
|