@nuxtjs/axios
Advanced tools
Comparing version 5.9.7 to 5.10.0
@@ -5,2 +5,16 @@ # Changelog | ||
## [5.10.0](https://github.com/nuxt-community/axios-module/compare/v5.9.7...v5.10.0) (2020-04-21) | ||
### Features | ||
* **plugin:** enable server brotli if supported (closes [#276](https://github.com/nuxt-community/axios-module/issues/276)) ([074f98c](https://github.com/nuxt-community/axios-module/commit/074f98cbdf409473357b2cd24cd6cb13fe75f149)) | ||
### Bug Fixes | ||
* **module:** browserBaseURL as empty string (fixes [#303](https://github.com/nuxt-community/axios-module/issues/303)) ([18afe5c](https://github.com/nuxt-community/axios-module/commit/18afe5c1a9aac6380bdd5ffb337a0968a6d504aa)) | ||
* **plugin:** preserve default headers (fixes [#323](https://github.com/nuxt-community/axios-module/issues/323)) ([6c5605d](https://github.com/nuxt-community/axios-module/commit/6c5605df0b77e9e4df32ad1eaecb2eac60eb1c1d)) | ||
* **plugin:** use `globalName` instead of `$nuxt` (fixes [#345](https://github.com/nuxt-community/axios-module/issues/345)) ([fd1f8ec](https://github.com/nuxt-community/axios-module/commit/fd1f8ec17160f6e88610e3dfa2153423b3140592)) | ||
### [5.9.7](https://github.com/nuxt-community/axios-module/compare/v5.9.6...v5.9.7) (2020-03-30) | ||
@@ -7,0 +21,0 @@ |
@@ -56,3 +56,3 @@ const path = require('path') | ||
baseURL: `http://${defaultHost}:${defaultPort}${prefix}`, | ||
browserBaseURL: null, | ||
browserBaseURL: undefined, | ||
credentials: false, | ||
@@ -82,3 +82,3 @@ debug: false, | ||
// Default browserBaseURL | ||
if (!options.browserBaseURL) { | ||
if (typeof options.browserBaseURL === 'undefined') { | ||
options.browserBaseURL = options.proxy ? prefix : options.baseURL | ||
@@ -85,0 +85,0 @@ } |
@@ -5,2 +5,11 @@ import Axios from 'axios' | ||
const globalName = '<%= globalName %>' | ||
// Check Node.js brotli support | ||
let brotliSupported | ||
if (process.server) { | ||
const zlib = require('zlib') | ||
brotliSupported = typeof zlib.createBrotliDecompress == 'function' | ||
} | ||
// Axios.prototype cannot be modified | ||
@@ -130,3 +139,3 @@ const axiosExtra = { | ||
const $loading = () => (window.$nuxt && window.$nuxt.$loading && window.$nuxt.$loading.set) ? window.$nuxt.$loading : noopLoading | ||
const $loading = () => (window[globalName] && window[globalName].$loading && window[globalName].$loading.set) ? window[globalName].$loading : noopLoading | ||
@@ -200,8 +209,13 @@ let currentRequests = 0 | ||
// Proxy SSR request headers headers | ||
axiosOptions.headers.common = (ctx.req && ctx.req.headers) ? Object.assign({}, ctx.req.headers) : {} | ||
<% for (let h of options.proxyHeadersIgnore) { %>delete axiosOptions.headers.common['<%= h %>'] | ||
<% } %><% } %> | ||
if (process.server && ctx.req && ctx.req.headers) { | ||
const reqHeaders = { ...ctx.req.headers } | ||
for (let h of <%= serialize(options.proxyHeadersIgnore) %>) { | ||
delete reqHeaders[h] | ||
} | ||
axiosOptions.headers.common = { ...reqHeaders, ...axiosOptions.headers.common } | ||
} | ||
<% } %> | ||
if (process.server) { | ||
// Don't accept brotli encoding because Node can't parse it | ||
// Don't accept brotli encoding because Node can't parse it | ||
if (process.server && !brotliSupported) { | ||
axiosOptions.headers.common['accept-encoding'] = 'gzip, deflate' | ||
@@ -208,0 +222,0 @@ } |
{ | ||
"name": "@nuxtjs/axios", | ||
"version": "5.9.7", | ||
"version": "5.10.0", | ||
"description": "Secure and easy axios integration with Nuxt.js", | ||
@@ -28,5 +28,5 @@ "license": "MIT", | ||
"axios": "^0.19.2", | ||
"axios-retry": "^3.1.2", | ||
"axios-retry": "^3.1.6", | ||
"consola": "^2.11.3", | ||
"defu": "^1.0.0" | ||
"defu": "^2.0.2" | ||
}, | ||
@@ -33,0 +33,0 @@ "devDependencies": { |
40768
339
+ Addeddefu@2.0.4(transitive)
- Removeddefu@1.0.0(transitive)
Updatedaxios-retry@^3.1.6
Updateddefu@^2.0.2