Buckets:
| ; | |
| import AxiosError from './AxiosError.js'; | |
| import isAbsoluteURL from '../helpers/isAbsoluteURL.js'; | |
| import combineURLs from '../helpers/combineURLs.js'; | |
| const malformedHttpProtocol = /^https?:(?!\/\/)/i; | |
| const httpProtocolControlCharacters = /[\t\n\r]/g; | |
| function stripLeadingC0ControlOrSpace(url) { | |
| let i = 0; | |
| while (i < url.length && url.charCodeAt(i) <= 0x20) { | |
| i++; | |
| } | |
| return url.slice(i); | |
| } | |
| function normalizeURLForProtocolCheck(url) { | |
| return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, ''); | |
| } | |
| function assertValidHttpProtocolURL(url, config) { | |
| if (typeof url === 'string' && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) { | |
| throw new AxiosError( | |
| 'Invalid URL: missing "//" after protocol', | |
| AxiosError.ERR_INVALID_URL, | |
| config | |
| ); | |
| } | |
| } | |
| /** | |
| * 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 | |
| */ | |
| export default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) { | |
| assertValidHttpProtocolURL(requestedURL, config); | |
| let isRelativeUrl = !isAbsoluteURL(requestedURL); | |
| if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) { | |
| assertValidHttpProtocolURL(baseURL, config); | |
| return combineURLs(baseURL, requestedURL); | |
| } | |
| return requestedURL; | |
| } | |
Xet Storage Details
- Size:
- 1.61 kB
- Xet hash:
- 1ef26b1a7fecf2e1bb1ca2c6b43c2a58015403822a8c3668fc5fa18bfa3ad852
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.