mirror of https://github.com/sundowndev/http.git
use object spread (#216)
parent
e8b8df3284
commit
932abc071b
|
@ -5,7 +5,7 @@ const logger = consola.withScope('nuxt:axios')
|
|||
|
||||
function axiosModule(_moduleOptions) {
|
||||
// Combine options
|
||||
const moduleOptions = Object.assign({}, this.options.axios, _moduleOptions)
|
||||
const moduleOptions = { ...this.options.axios, ..._moduleOptions }
|
||||
|
||||
// Default port
|
||||
const defaultPort =
|
||||
|
@ -32,21 +32,19 @@ function axiosModule(_moduleOptions) {
|
|||
const prefix = process.env.API_PREFIX || moduleOptions.prefix || '/'
|
||||
|
||||
// Apply defaults
|
||||
const options = Object.assign(
|
||||
{
|
||||
baseURL: `http://${defaultHost}:${defaultPort}${prefix}`,
|
||||
browserBaseURL: null,
|
||||
credentials: false,
|
||||
debug: false,
|
||||
progress: true,
|
||||
proxyHeaders: true,
|
||||
proxyHeadersIgnore: ['accept', 'host', 'cf-ray', 'cf-connecting-ip'],
|
||||
proxy: false,
|
||||
retry: false,
|
||||
https: false
|
||||
},
|
||||
moduleOptions
|
||||
)
|
||||
const options = {
|
||||
baseURL: `http://${defaultHost}:${defaultPort}${prefix}`,
|
||||
browserBaseURL: null,
|
||||
credentials: false,
|
||||
debug: false,
|
||||
progress: true,
|
||||
proxyHeaders: true,
|
||||
proxyHeadersIgnore: ['accept', 'host', 'cf-ray', 'cf-connecting-ip'],
|
||||
proxy: false,
|
||||
retry: false,
|
||||
https: false,
|
||||
...moduleOptions
|
||||
}
|
||||
|
||||
// ENV overrides
|
||||
|
||||
|
|
Loading…
Reference in New Issue