puter-rest.js 615 B

1234567891011121314151617181920212223
  1. const axios = require('axios');
  2. class PuterRestTestSDK {
  3. constructor (config) {
  4. this.config = config;
  5. }
  6. async create() {
  7. const conf = this.config;
  8. const axiosInstance = axios.create({
  9. httpsAgent: new https.Agent({
  10. rejectUnauthorized: false,
  11. }),
  12. baseURL: conf.url,
  13. headers: {
  14. 'Authorization': `Bearer ${conf.token}`, // common headers
  15. //... other headers
  16. }
  17. });
  18. return axiosInstance;
  19. }
  20. }
  21. module.exports = ({ config }) => new PuterRestTestSDK(config);