allow changing axios settings
This commit is contained in:
parent
ab73d68c28
commit
a713d6ecae
File diff suppressed because it is too large
Load Diff
|
|
@ -1,4 +1,4 @@
|
||||||
import axios, { AxiosInstance } from "axios"
|
import axios, { AxiosInstance, CreateAxiosDefaults } from "axios"
|
||||||
import { Cookie, CookieJar } from "tough-cookie"
|
import { Cookie, CookieJar } from "tough-cookie"
|
||||||
|
|
||||||
import { FE_MUSIC_HOME } from "./constants"
|
import { FE_MUSIC_HOME } from "./constants"
|
||||||
|
|
@ -36,7 +36,7 @@ export default class YTMusic {
|
||||||
* Creates an instance of YTMusic
|
* Creates an instance of YTMusic
|
||||||
* Make sure to call initialize()
|
* Make sure to call initialize()
|
||||||
*/
|
*/
|
||||||
public constructor() {
|
public constructor(opts?: CreateAxiosDefaults) {
|
||||||
this.cookiejar = new CookieJar()
|
this.cookiejar = new CookieJar()
|
||||||
this.config = {}
|
this.config = {}
|
||||||
this.client = axios.create({
|
this.client = axios.create({
|
||||||
|
|
@ -47,6 +47,7 @@ export default class YTMusic {
|
||||||
"Accept-Language": "en-US,en;q=0.5",
|
"Accept-Language": "en-US,en;q=0.5",
|
||||||
},
|
},
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
|
...opts
|
||||||
})
|
})
|
||||||
|
|
||||||
this.client.interceptors.request.use(req => {
|
this.client.interceptors.request.use(req => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue