@commercetools-frontend/mc-dev-authentication 24.7.0 → 24.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,21 @@ const trimTrailingSlash = value => value.replace(/\/$/, '');
16
16
  function createMcDevAuthenticationMiddleware(applicationConfig) {
17
17
  const isDevAuthenticationMiddlewareDisabled = String(applicationConfig.env.disableAuthRoutesOfDevServer) === 'true' || applicationConfig.env.servedByProxy;
18
18
  return (request, response, next) => {
19
+ // This endpoint is meant to be used in Cypress tests to ensure
20
+ // that the primary origin is set to localhost.
21
+ if (request.originalUrl === '/api/health') {
22
+ response.statusCode = 200;
23
+ if (request.headers.accept === 'application/json') {
24
+ response.setHeader('Content-Type', 'application/json');
25
+ response.end(_JSON$stringify__default["default"]({
26
+ healthy: true
27
+ }));
28
+ } else {
29
+ response.setHeader('Content-Type', 'text/html');
30
+ response.end(`healthy = true`);
31
+ }
32
+ return;
33
+ }
19
34
  if (request.originalUrl === '/api/graphql') {
20
35
  response.statusCode = 404;
21
36
  response.setHeader('Content-Type', 'application/json');
@@ -16,6 +16,21 @@ const trimTrailingSlash = value => value.replace(/\/$/, '');
16
16
  function createMcDevAuthenticationMiddleware(applicationConfig) {
17
17
  const isDevAuthenticationMiddlewareDisabled = String(applicationConfig.env.disableAuthRoutesOfDevServer) === 'true' || applicationConfig.env.servedByProxy;
18
18
  return (request, response, next) => {
19
+ // This endpoint is meant to be used in Cypress tests to ensure
20
+ // that the primary origin is set to localhost.
21
+ if (request.originalUrl === '/api/health') {
22
+ response.statusCode = 200;
23
+ if (request.headers.accept === 'application/json') {
24
+ response.setHeader('Content-Type', 'application/json');
25
+ response.end(_JSON$stringify__default["default"]({
26
+ healthy: true
27
+ }));
28
+ } else {
29
+ response.setHeader('Content-Type', 'text/html');
30
+ response.end(`healthy = true`);
31
+ }
32
+ return;
33
+ }
19
34
  if (request.originalUrl === '/api/graphql') {
20
35
  response.statusCode = 404;
21
36
  response.setHeader('Content-Type', 'application/json');
@@ -6,6 +6,21 @@ const trimTrailingSlash = value => value.replace(/\/$/, '');
6
6
  function createMcDevAuthenticationMiddleware(applicationConfig) {
7
7
  const isDevAuthenticationMiddlewareDisabled = String(applicationConfig.env.disableAuthRoutesOfDevServer) === 'true' || applicationConfig.env.servedByProxy;
8
8
  return (request, response, next) => {
9
+ // This endpoint is meant to be used in Cypress tests to ensure
10
+ // that the primary origin is set to localhost.
11
+ if (request.originalUrl === '/api/health') {
12
+ response.statusCode = 200;
13
+ if (request.headers.accept === 'application/json') {
14
+ response.setHeader('Content-Type', 'application/json');
15
+ response.end(_JSON$stringify({
16
+ healthy: true
17
+ }));
18
+ } else {
19
+ response.setHeader('Content-Type', 'text/html');
20
+ response.end(`healthy = true`);
21
+ }
22
+ return;
23
+ }
9
24
  if (request.originalUrl === '/api/graphql') {
10
25
  response.statusCode = 404;
11
26
  response.setHeader('Content-Type', 'application/json');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/mc-dev-authentication",
3
- "version": "24.7.0",
3
+ "version": "24.7.2",
4
4
  "description": "Authentication views when running webpack-dev-server in development mode",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "@tsconfig/node22": "^22.0.0",
37
37
  "@types/connect": "^3.4.36",
38
38
  "connect": "^3.7.0",
39
- "@commercetools-frontend/application-config": "24.7.0"
39
+ "@commercetools-frontend/application-config": "24.7.2"
40
40
  },
41
41
  "engines": {
42
42
  "node": "18.x || 20.x || >=22.0.0"