Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular-devkit/build-angular): correctly respond to preflight re…
…quests With this commit, we add a middleware that handles preflight requests as currently responses for this type of requests returning 404. This is a temporary workaround until this issue is fixed upstream. See: webpack/webpack-dev-server#4180 Closes #23639 (cherry picked from commit b4a1b0f)
- Loading branch information
1 parent
76539db
commit c984710
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
tests/legacy-cli/e2e/tests/commands/serve/preflight-request.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import fetch from 'node-fetch'; | ||
import { ngServe } from '../../../utils/project'; | ||
|
||
export default async function () { | ||
const port = await ngServe(); | ||
const { size, status } = await fetch(`http://localhost:${port}/main.js`, { method: 'OPTIONS' }); | ||
|
||
if (size !== 0) { | ||
throw new Error(`Expected "size" to be "0" but got "${size}".`); | ||
} | ||
|
||
if (status !== 204) { | ||
throw new Error(`Expected "status" to be "204" but got "${status}".`); | ||
} | ||
} |