File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ If you are coming from an older release please be sure to read [Migration Guide]
6363 * [ Prefix, Host and Port] ( #prefix-host-and-port )
6464 * [ baseURL] ( #baseurl )
6565 * [ browserBaseURL] ( #browserbaseurl )
66+ * [ https] ( #https )
6667 * [ progress] ( #progress )
6768 * [ proxy] ( #proxy )
6869 * [ retry] ( #retry )
@@ -306,6 +307,12 @@ Base URL which is used and prepended to make requests in client side.
306307
307308Environment variable ` API_URL_BROWSER ` can be used to ** override** ` browserBaseURL ` .
308309
310+ ### ` https `
311+
312+ * Default: ` false `
313+
314+ If set to ` true ` , ` http:// ` in both ` baseURL ` and ` browserBaseURL ` will be changed into ` https:// ` .
315+
309316### ` progress `
310317
311318* Default: ` true `
Original file line number Diff line number Diff line change @@ -41,7 +41,8 @@ module.exports = function nuxtAxios (_moduleOptions) {
4141 proxyHeaders : true ,
4242 proxyHeadersIgnore : [ 'accept' , 'host' ] ,
4343 proxy : false ,
44- retry : false
44+ retry : false ,
45+ https : false
4546 } ,
4647 moduleOptions
4748 )
@@ -70,6 +71,13 @@ module.exports = function nuxtAxios (_moduleOptions) {
7071 options . retry = { }
7172 }
7273
74+ // Convert http:// to https:// if https option is on
75+ if ( options . https === true ) {
76+ const https = s => s . replace ( 'http://' , 'https://' )
77+ options . baseURL = https ( options . baseURL )
78+ options . browserBaseURL = https ( options . browserBaseURL )
79+ }
80+
7381 // Register plugin
7482 this . addPlugin ( {
7583 src : path . resolve ( __dirname , 'plugin.template.js' ) ,
You can’t perform that action at this time.
0 commit comments