mirror of
https://github.com/HeyPuter/puter.git
synced 2025-01-23 06:00:21 +08:00
24 lines
615 B
JavaScript
24 lines
615 B
JavaScript
const axios = require('axios');
|
|
|
|
class PuterRestTestSDK {
|
|
constructor (config) {
|
|
this.config = config;
|
|
}
|
|
async create() {
|
|
const conf = this.config;
|
|
const axiosInstance = axios.create({
|
|
httpsAgent: new https.Agent({
|
|
rejectUnauthorized: false,
|
|
}),
|
|
baseURL: conf.url,
|
|
headers: {
|
|
'Authorization': `Bearer ${conf.token}`, // common headers
|
|
//... other headers
|
|
}
|
|
});
|
|
return axiosInstance;
|
|
}
|
|
}
|
|
|
|
module.exports = ({ config }) => new PuterRestTestSDK(config);
|