Skip to content

Commit

Permalink
feat: Support configuring response headers for development environmen…
Browse files Browse the repository at this point in the history
…t server
  • Loading branch information
myth929 authored and emosheeep committed Apr 17, 2024
1 parent f16cea2 commit 30ec7f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# vite-plugin-virtual-mpa

## 1.11.0

### Minor Changes

- feat: Support configuring response headers for development environment server

## 1.10.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-virtual-mpa",
"version": "1.10.1",
"version": "1.11.0",
"author": "秦旭洋 <[email protected]>",
"license": "MIT",
"description": "Out-of-box MPA plugin for Vite, with html template engine and virtual files support.",
Expand Down
3 changes: 3 additions & 0 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ export function createMpaPlugin<
return next(); // This allows vite handling unmatched paths.
}

Object.entries(config?.server?.headers || {}).forEach(([key, value]) => {
res.setHeader(key, value!);
});
/**
* The following 2 lines fixed #12.
* When using cypress for e2e testing, we should manually set response header and status code.
Expand Down

0 comments on commit 30ec7f6

Please sign in to comment.