hatch-surf/internal/store/schema.sql
SoftwareEngineer 4256d34c27 feat: add one-click replay for captured requests
- Add POST /e/{endpoint}/requests/{id}/replay endpoint
- Replay re-sends captured method, path, headers, query, body to target URL
- Response includes target status code, headers, body (truncated 64KB)
- SSRF guard: denies replay to private/loopback by default
- Opt-in env var HATCH_ALLOW_PRIVATE_REPLAY=true for local dev
- Server-rendered inspect page at GET /e/{endpoint} with replay button UI
- SSE live stream for new requests (EventSource)
- Mock configuration at PUT /e/{endpoint}/mock
- Store: GetRequest, GetMock, SetMock methods added
- Chi router migration from stdlib ServeMux
- 26 passing tests including replay unit tests and E2E capture-to-replay

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-06-22 16:58:42 +02:00

22 lines
742 B
SQL

CREATE TABLE IF NOT EXISTS endpoints (
id TEXT NOT NULL PRIMARY KEY,
url TEXT NOT NULL UNIQUE,
created_at TEXT NOT NULL,
updated_at TEXT NOT NULL,
mock_status INTEGER,
mock_headers TEXT,
mock_body BLOB
);
CREATE TABLE IF NOT EXISTS requests (
id TEXT NOT NULL PRIMARY KEY,
endpoint_id TEXT NOT NULL REFERENCES endpoints(id),
method TEXT NOT NULL,
path TEXT NOT NULL,
headers TEXT NOT NULL DEFAULT '{}',
query TEXT NOT NULL DEFAULT '',
body BLOB,
created_at TEXT NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_requests_endpoint_id ON requests(endpoint_id);
CREATE INDEX IF NOT EXISTS idx_requests_created_at ON requests(created_at);