puter/tools/api-tester/test_sdks/puter-rest.js

24 lines
615 B
JavaScript
Raw Normal View History

2025-01-10 04:51:50 +08:00
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);