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,8 +32,7 @@ function axiosModule(_moduleOptions) {
|
|||
const prefix = process.env.API_PREFIX || moduleOptions.prefix || '/'
|
||||
|
||||
// Apply defaults
|
||||
const options = Object.assign(
|
||||
{
|
||||
const options = {
|
||||
baseURL: `http://${defaultHost}:${defaultPort}${prefix}`,
|
||||
browserBaseURL: null,
|
||||
credentials: false,
|
||||
|
@ -43,10 +42,9 @@ function axiosModule(_moduleOptions) {
|
|||
proxyHeadersIgnore: ['accept', 'host', 'cf-ray', 'cf-connecting-ip'],
|
||||
proxy: false,
|
||||
retry: false,
|
||||
https: false
|
||||
},
|
||||
moduleOptions
|
||||
)
|
||||
https: false,
|
||||
...moduleOptions
|
||||
}
|
||||
|
||||
// ENV overrides
|
||||
|
||||
|
|
Loading…
Reference in New Issue