docs: document gateway http helpers · openclaw/openclaw@d76301e
steipete
·
2026-06-05
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Covers control-plane write rate-limit windows, stale bucket pruning, and |
| 2 | +// hard bucket cap behavior. |
1 | 3 | import { afterEach, describe, expect, test } from "vitest"; |
2 | 4 | import { |
3 | 5 | consumeControlPlaneWriteBudget, |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Control-plane rate limiting bounds write-side RPC attempts per device/IP and |
| 2 | +// caps bucket growth against unique-key memory pressure. |
1 | 3 | import type { GatewayClient } from "./server-methods/types.js"; |
2 | 4 | |
3 | 5 | const CONTROL_PLANE_RATE_LIMIT_MAX_REQUESTS = 3; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Control UI HTTP utilities provide tiny plain-text helpers for static routes |
| 2 | +// before requests enter the larger Gateway JSON/auth stack. |
1 | 3 | import type { ServerResponse } from "node:http"; |
2 | 4 | |
3 | 5 | // Small HTTP response helpers used by Control UI routes before they enter the |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Deterministic fuzz coverage for shared Gateway HTTP helpers and disconnect |
| 2 | +// handling without adding a property-test dependency. |
1 | 3 | import { EventEmitter } from "node:events"; |
2 | 4 | import type { IncomingMessage } from "node:http"; |
3 | 5 | import { beforeEach, describe, expect, it, vi } from "vitest"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Shared Gateway HTTP helpers handle small JSON/text responses, SSE headers, |
| 2 | +// body-size errors, and client disconnect aborts. |
1 | 3 | import type { IncomingMessage, ServerResponse } from "node:http"; |
2 | 4 | import { |
3 | 5 | logRejectedLargePayload, |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Gateway HTTP test helpers build minimal request/response doubles and collect |
| 2 | +// client response bodies. |
1 | 3 | import type { EventEmitter } from "node:events"; |
2 | 4 | import type { IncomingMessage, ServerResponse } from "node:http"; |
3 | 5 | import { PassThrough } from "node:stream"; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。