Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/axios/lib/core/buildFullPath.js
1126 views
1
'use strict';
2
3
var isAbsoluteURL = require('../helpers/isAbsoluteURL');
4
var combineURLs = require('../helpers/combineURLs');
5
6
/**
7
* Creates a new URL by combining the baseURL with the requestedURL,
8
* only when the requestedURL is not already an absolute URL.
9
* If the requestURL is absolute, this function returns the requestedURL untouched.
10
*
11
* @param {string} baseURL The base URL
12
* @param {string} requestedURL Absolute or relative URL to combine
13
* @returns {string} The combined full path
14
*/
15
module.exports = function buildFullPath(baseURL, requestedURL) {
16
if (baseURL && !isAbsoluteURL(requestedURL)) {
17
return combineURLs(baseURL, requestedURL);
18
}
19
return requestedURL;
20
};
21
22