File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,13 @@ import defu from 'defu'
4
4
5
5
const globalName = '<%= globalName %>'
6
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
+
7
14
// Axios.prototype cannot be modified
8
15
const axiosExtra = {
9
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
}
213
220
You can’t perform that action at this time.
0 commit comments