Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
HTTP (config, opts) {
const start = new Date()
opts || (opts = {})
const payload = config.data
const cache = config.cache
const timeout = config.timeout
const params = config.params
config = utils.copy(config, null, null, null, ['data', 'cache', 'timeout', 'params']) // params could have data, cache, timeout
config.params = utils.copy(params)
config = utils.deepMixIn(config, this.httpConfig)
config.data = payload
config.cache = cache
if (timeout !== undefined) {
config.timeout = timeout
}
if (this.forceTrailingSlash && config.url[config.url.length - 1] !== '/') {
config.url += '/'
}
config.method = config.method.toUpperCase()
const suffix = config.suffix || opts.suffix || this.suffix
if (suffix && config.url.substr(config.url.length - suffix.length) !== suffix) {
config.url += suffix
}
const logResponse = (data) => {
HTTP (config, opts) {
const start = new Date()
opts || (opts = {})
const payload = config.data
const cache = config.cache
const timeout = config.timeout
const params = config.params
config = utils.copy(config, null, null, null, ['data', 'cache', 'timeout', 'params']) // params could have data, cache, timeout
config.params = utils.copy(params)
config = utils.deepMixIn(config, this.httpConfig)
config.data = payload
config.cache = cache
if (timeout !== undefined) {
config.timeout = timeout
}
if (this.forceTrailingSlash && config.url[config.url.length - 1] !== '/') {
config.url += '/'
}
config.method = config.method.toUpperCase()
const suffix = config.suffix || opts.suffix || this.suffix
if (suffix && config.url.substr(config.url.length - suffix.length) !== suffix) {
config.url += suffix
}
getParams (opts) {
opts || (opts = {})
if (opts.params === undefined) {
return {}
}
return utils.copy(opts.params)
},