|
1 | | -const combineURLs = require("axios/lib/helpers/combineURLs"); |
2 | | -const isAbsoluteURL = require("axios/lib/helpers/isAbsoluteURL"); |
3 | | -const axios = require("axios"); |
| 1 | +const { default: axios } = require("axios"); |
4 | 2 | const querystring = require("query-string"); |
5 | 3 | const { sign } = require("./RequestSigner"); |
6 | 4 | const { PDKServerResponseError } = require("./PDKError"); |
7 | 5 | const FormData = require("form-data"); |
8 | 6 |
|
| 7 | +/** |
| 8 | + * https://github.com/axios/axios/blob/5b8a826771b77ab30081d033fdba9ef3b90e439a/lib/helpers/isAbsoluteURL.js |
| 9 | + * Determines whether the specified URL is absolute |
| 10 | + * @ignore |
| 11 | + * @param {string} url The URL to test |
| 12 | + * @returns {boolean} True if the specified URL is absolute, otherwise false |
| 13 | + */ |
| 14 | +function isAbsoluteURL(url) { |
| 15 | + // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). |
| 16 | + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed |
| 17 | + // by any combination of letters, digits, plus, period, or hyphen. |
| 18 | + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); |
| 19 | +} |
| 20 | + |
| 21 | +/** |
| 22 | + * https://github.com/axios/axios/blob/5b8a826771b77ab30081d033fdba9ef3b90e439a/lib/helpers/combineURLs.js |
| 23 | + * Creates a new URL by combining the specified URLs |
| 24 | + * @ignore |
| 25 | + * @param {string} baseURL The base URL |
| 26 | + * @param {string} relativeURL The relative URL |
| 27 | + * @returns {string} The combined URL |
| 28 | + */ |
| 29 | +function combineURLs(baseURL, relativeURL) { |
| 30 | + return relativeURL |
| 31 | + ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") |
| 32 | + : baseURL; |
| 33 | +} |
| 34 | + |
9 | 35 | axios.defaults.withCredentials = true; |
10 | 36 |
|
11 | 37 | function transformRequestOptions(params) { |
@@ -115,7 +141,7 @@ function userAgentInterceptor(options) { |
115 | 141 | return (config) => { |
116 | 142 | const sdk = { |
117 | 143 | name: "@pixelbin/admin", |
118 | | - version: "4.1.0", |
| 144 | + version: "4.1.1", |
119 | 145 | }; |
120 | 146 | const language = "JavaScript"; |
121 | 147 |
|
|
0 commit comments