163music-api
Version:
NeteaseMusicApi's TypeScript Version
19 lines (18 loc) • 502 B
JavaScript
;
const config_1 = require('./config');
exports.deepClone = (obj) => {
return JSON.parse(JSON.stringify(obj));
};
exports.getRequestOption = (path, method = 'GET', contentLength) => {
let headerArr = exports.deepClone(config_1.headers);
if (contentLength) {
headerArr['Content-Length'] = contentLength;
}
return {
port: 80,
host: 'music.163.com',
method: method,
path: path,
headers: headerArr
};
};