diff --git a/test/axios.test.js b/test/axios.test.js index 9f01e0c..d0ce27b 100644 --- a/test/axios.test.js +++ b/test/axios.test.js @@ -32,8 +32,8 @@ const testSuite = () => { const call = addTemplate.mock.calls.find(args => args[0].src.includes('plugin.js')) const options = call[0].options const proto = options.https ? 'https' : 'http' - expect(options.baseURL.toString()).toBe(`${proto}://localhost:3000/api/test`) - expect(options.browserBaseURL.toString()).toBe('/api/test') + expect(options.baseURL.toString()).toBe(`${proto}://localhost:3000/api`) + expect(options.browserBaseURL.toString()).toBe('/api') }) test('asyncData', async () => { @@ -121,7 +121,7 @@ describe('module', () => { describe('other options', () => { beforeAll(async () => { config.axios = { - prefix: '/api/test', + prefix: '/api', proxy: {}, credentials: true, https: true, @@ -141,7 +141,7 @@ describe('other options', () => { describe('browserBaseURL', () => { beforeAll(async () => { config.axios = { - browserBaseURL: '/api/test' + browserBaseURL: '/api' } await setupNuxt(config) @@ -156,7 +156,7 @@ describe('browserBaseURL', () => { const call = addTemplate.mock.calls.find(args => args[0].src.includes('plugin.js')) const options = call[0].options expect(options.baseURL.toString()).toBe('http://localhost:3000/') - expect(options.browserBaseURL.toString()).toBe('/api/test') + expect(options.browserBaseURL.toString()).toBe('/api') }) }) diff --git a/test/fixture/api/test.js b/test/fixture/api/echo.js similarity index 100% rename from test/fixture/api/test.js rename to test/fixture/api/echo.js diff --git a/test/fixture/nuxt.config.js b/test/fixture/nuxt.config.js index f457099..85f62a8 100644 --- a/test/fixture/nuxt.config.js +++ b/test/fixture/nuxt.config.js @@ -11,7 +11,7 @@ module.exports = { { handler: require('../../') } ], serverMiddleware: { - '/api/test': '~/api/test', + '/api/echo': '~/api/echo', '/api/cookie': '~/api/cookie' }, axios: { diff --git a/test/fixture/pages/asyncData.vue b/test/fixture/pages/asyncData.vue index 6831346..b37d3ad 100644 --- a/test/fixture/pages/asyncData.vue +++ b/test/fixture/pages/asyncData.vue @@ -7,7 +7,7 @@ diff --git a/test/fixture/pages/ssr.vue b/test/fixture/pages/ssr.vue index d23e85c..0134c29 100644 --- a/test/fixture/pages/ssr.vue +++ b/test/fixture/pages/ssr.vue @@ -20,16 +20,16 @@ export default { }, computed: { axiosSessionId () { - return this.$axios.defaults.defaultHeaders.SessionId + return this.$axios.defaults.headers.common.SessionId }, axiosEncoding () { - return this.$axios.defaults.defaultHeaders['accept-encoding'] + return this.$axios.defaults.headers.common['accept-encoding'] }, newInstanceSessionId () { - return this.newInstance.defaults.defaultHeaders.SessionId + return this.newInstance.defaults.headers.common.SessionId }, newInstanceHeaders () { - return this.newInstance.defaults.defaultHeaders + return this.newInstance.defaults.headers.common } }, created () {