Fix Storybook pattern library proxying in Node 18

pull/10080/head
Thibaud Colas 2023-02-14 11:17:58 +00:00 zatwierdzone przez LB (Ben Johnston)
rodzic a517ee6dc9
commit fa1cbfbe98
3 zmienionych plików z 6 dodań i 2 usunięć

Wyświetl plik

@ -1,7 +1,8 @@
/* eslint-disable @typescript-eslint/no-var-requires, import/no-extraneous-dependencies */
const middleware = require('storybook-django/src/middleware');
const origin = process.env.TEST_ORIGIN ?? 'http://localhost:8000';
// Target the Django server with IPV4 address explicitly to avoid DNS resolution of localhost to IPV6.
const origin = process.env.TEST_ORIGIN ?? 'http://127.0.0.1:8000';
module.exports = middleware.createDjangoAPIMiddleware({
origin,

Wyświetl plik

@ -200,7 +200,7 @@ npm --prefix client/tests/integration install
npm run test:integration
```
Integration tests target `http://localhost:8000` by default. Use the `TEST_ORIGIN` environment variable to use a different port, or test a remote Wagtail instance: `TEST_ORIGIN=http://localhost:9000 npm run test:integration`.
Integration tests target `http://127.0.0.1:8000` by default. Use the `TEST_ORIGIN` environment variable to use a different port, or test a remote Wagtail instance: `TEST_ORIGIN=http://127.0.0.1:9000 npm run test:integration`.
### Browser and device support

Wyświetl plik

@ -9,6 +9,9 @@ INSTALLED_APPS += [ # noqa
"pattern_library",
]
# Allow loopback address to access the server without DNS resolution (lack of Happy Eyeballs in Node 18).
ALLOWED_HOSTS += ["127.0.0.1"] # noqa
TEMPLATES[0]["OPTIONS"]["builtins"] = ["pattern_library.loader_tags"] # noqa
PATTERN_LIBRARY = {