@joinremba/gate 0.5.0 → 0.5.1
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/package.json +1 -1
- package/src/adapters/hono.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joinremba/gate",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "API safety layer for TypeScript backends. Validate requests, format responses, prevent duplicates, manage API keys, and protect endpoints from abuse.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
package/src/adapters/hono.ts
CHANGED
|
@@ -26,7 +26,7 @@ export function createRateLimiter({
|
|
|
26
26
|
return createMiddleware(async (c: Context, next: Next) => {
|
|
27
27
|
const identifier = getKey
|
|
28
28
|
? getKey(c)
|
|
29
|
-
: ((
|
|
29
|
+
: (c.get("clientIp") as string | undefined) ??
|
|
30
30
|
c.req.header("x-forwarded-for") ??
|
|
31
31
|
"unknown";
|
|
32
32
|
|
|
@@ -108,7 +108,7 @@ export function requireIdempotencyKey({
|
|
|
108
108
|
if (status === undefined || status < 500) {
|
|
109
109
|
gate.idempotency.setResponse(key, body).catch(() => {});
|
|
110
110
|
}
|
|
111
|
-
return originalJson(body, status as
|
|
111
|
+
return originalJson(body, status as any, headers);
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
await next();
|