Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(accessToken, opts) {
addMethods(this)
// variadic arguments
if (typeof accessToken === 'object') {
opts = accessToken
accessToken = null
}
// default opts
opts = Object.assign(
{
userAgent: 'netlify/js-client',
scheme: dfn.schemes[0],
host: dfn.host,
pathPrefix: dfn.basePath,
accessToken,
globalParams: {}
},
opts
)
this.defaultHeaders = {
'User-agent': opts.userAgent,
accept: 'application/json'
}
this.scheme = opts.scheme
this.host = opts.host
this.pathPrefix = opts.pathPrefix
this.globalParams = opts.globalParams
this.accessToken = opts.accessToken
constructor(accessToken, opts) {
if (typeof accessToken === 'object') {
opts = accessToken
accessToken = null
}
opts = Object.assign(
{
userAgent: '@netlify/js-client',
scheme: dfn.schemes[0],
host: dfn.host,
pathPrefix: dfn.basePath
},
opts
)
this.defaultHeaders = {
'User-agent': opts.userAgent,
accept: 'application/json'
}
this.scheme = opts.scheme
this.host = opts.host
this.pathPrefix = opts.pathPrefix
this.globalParams = Object.assign({}, opts.globalParams)
if (accessToken) this.accessToken = accessToken
}