@papi-ai/server 0.7.9 → 0.7.10
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/dist/index.js +7 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22579,8 +22579,13 @@ If you already have an account, check that both **PAPI_PROJECT_ID** and **PAPI_D
|
|
|
22579
22579
|
}
|
|
22580
22580
|
if (httpToken) {
|
|
22581
22581
|
const authHeader = req.headers["authorization"] ?? "";
|
|
22582
|
-
const
|
|
22583
|
-
|
|
22582
|
+
const bearerMatch = authHeader.startsWith("Bearer ") ? authHeader.slice(7) : "";
|
|
22583
|
+
const urlMatch = req.url?.match(/^\/(mcp|sse)\/(.+)$/);
|
|
22584
|
+
const urlToken = urlMatch?.[2];
|
|
22585
|
+
if (bearerMatch === httpToken) {
|
|
22586
|
+
} else if (urlToken === httpToken) {
|
|
22587
|
+
req.url = `/${urlMatch[1]}`;
|
|
22588
|
+
} else {
|
|
22584
22589
|
res.writeHead(401, { "Content-Type": "application/json" });
|
|
22585
22590
|
res.end(JSON.stringify({ error: "Unauthorized" }));
|
|
22586
22591
|
return;
|
package/package.json
CHANGED