File tree Expand file tree Collapse file tree 1 file changed +26
-19
lines changed Expand file tree Collapse file tree 1 file changed +26
-19
lines changed Original file line number Diff line number Diff line change @@ -148,26 +148,33 @@ const setupProgress = (axios, ctx) => {
148148} < %  }  % > 
149149
150150export  default  ( ctx ,  inject )  = >  { 
151-   const  axiosOptions =  { 
152-     // baseURL 
153-     baseURL  : process . browser 
151+   // baseURL 
152+   const  baseURL =  process . browser 
154153      ? '<%= options.browserBaseURL %>' 
155-       : ( process . env . _AXIOS_BASE_URL_  ||  '<%= options.baseURL %>' ) , 
156- 
157-     // Create fresh objects for all default header scopes 
158-     // Axios creates only one which is shared across SSR requests! 
159-     // https://github.com/mzabriskie/axios/blob/master/lib/defaults.js 
160-     headers : { 
161-       common  : { 
162-         'Accept' : 'application/json, text/plain, */*' 
163-       } , 
164-       delete : { } , 
165-       get : { } , 
166-       head : { } , 
167-       post : { } , 
168-       put : { } , 
169-       patch : { } 
170-     } 
154+       : ( process . env . _AXIOS_BASE_URL_  ||  '<%= options.baseURL %>' ) 
155+ 
156+   // Create fresh objects for all default header scopes 
157+   // Axios creates only one which is shared across SSR requests! 
158+   // https://github.com/mzabriskie/axios/blob/master/lib/defaults.js 
159+   const  headers  =  { 
160+     common  : { 
161+       'Accept' : 'application/json, text/plain, */*' 
162+     } , 
163+     delete : { } , 
164+     get : { } , 
165+     head : { } , 
166+     post : { } , 
167+     put : { } , 
168+     patch : { } 
169+   } 
170+ 
171+   if  ( process . server )  { 
172+     headers . common [ 'Accept-Encoding' ]  =  'gzip, deflate' 
173+   } 
174+                              
175+   const  axiosOptions  =  { 
176+     baseURL, 
177+     headers
171178  } 
172179
173180  < %  if  ( options . proxyHeaders )  {  % > 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments