We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 18afe5c commit 074f98cCopy full SHA for 074f98c
1 file changed
lib/plugin.js
@@ -4,6 +4,13 @@ import defu from 'defu'
4
5
const globalName = '<%= globalName %>'
6
7
+// Check Node.js brotli support
8
+let brotliSupported
9
+if (process.server) {
10
+ const zlib = require('zlib')
11
+ brotliSupported = typeof zlib.createBrotliDecompress == 'function'
12
+}
13
+
14
// Axios.prototype cannot be modified
15
const axiosExtra = {
16
setBaseURL (baseURL) {
@@ -206,8 +213,8 @@ export default (ctx, inject) => {
206
213
}
207
214
<% } %>
208
215
209
- if (process.server) {
210
- // Don't accept brotli encoding because Node can't parse it
216
+ // Don't accept brotli encoding because Node can't parse it
217
+ if (process.server && !brotliSupported) {
211
218
axiosOptions.headers.common['accept-encoding'] = 'gzip, deflate'
212
219
220
0 commit comments