File size: 638 Bytes
61d39e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);