npm-middleware-repo 1.0.2 → 1.0.3
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.
- package/index.js +8 -0
- package/package.json +1 -1
- package/test-app/index.js +0 -1
package/index.js
CHANGED
|
@@ -7,9 +7,17 @@ function initializeSK8Middleware({ apiKey, baseUrl }) {
|
|
|
7
7
|
|
|
8
8
|
return async function embeddedMiddleware(req, res, next) {
|
|
9
9
|
try {
|
|
10
|
+
const clientId = req.clientId;
|
|
11
|
+
if (clientId === null || clientId === undefined || clientId === '') {
|
|
12
|
+
throw new Error(
|
|
13
|
+
'SK8 embedded middleware: req.clientId is required and cannot be empty',
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
10
17
|
const targetUrl = `${finalBaseUrl}${req.url}`;
|
|
11
18
|
const headers = {
|
|
12
19
|
'x-api-key': apiKey,
|
|
20
|
+
'x-client-id': String(clientId),
|
|
13
21
|
};
|
|
14
22
|
|
|
15
23
|
if (req.headers['content-type']) {
|
package/package.json
CHANGED
package/test-app/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { initializeSK8Middleware } from 'npm-middleware-repo';
|