Skip to content

Commit

Permalink
Fix e2e test wait-on local server
Browse files Browse the repository at this point in the history
Work around wait-on 404 error

Originally from: vitejs/vite#9520 (comment)
  • Loading branch information
samanehsan committed Aug 21, 2023
1 parent 9bf60d8 commit fcbb24e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ const bigQueryApi = 'https://bigquery.googleapis.com';
const googleSheetsApi = 'https://sheets.googleapis.com';
const driveApi = 'https://www.googleapis.com';

function fixAcceptHeader404() {
return {
name: 'fix-accept-header-404', // issue with vite dev server: https://github.com/vitejs/vite/issues/9520
configureServer(server) {
server.middlewares.use((req, _res, next) => {
if (req.headers.accept == 'application/json, text/plain, */*') {
req.headers.accept = '*/*';
}
next();
});
},
};
}

dns.setDefaultResultOrder('verbatim');

export default defineConfig({
Expand All @@ -29,6 +43,7 @@ export default defineConfig({
svgr(),
tsconfigPaths(),
eslint(),
fixAcceptHeader404(),
],
server: {
port: 3000,
Expand Down

0 comments on commit fcbb24e

Please sign in to comment.