Add test: POST /api/generate returns 429 when per-user rate limit exceeded #1031

Open
opened 2026-04-12 09:44:00 -04:00 by pook · 0 comments
Owner

In tests/generate/rate-limit.test.ts (or create it), add test cases:

  1. Authenticate as a test user
  2. Send 5 rapid POST requests to /api/generate with valid payloads (match the configured rate limit threshold)
  3. Verify the first N requests return 200
  4. Verify the (N+1)th request returns 429 Too Many Requests
  5. Verify the 429 response includes Retry-After header or { error: 'Rate limit exceeded' } body

This validates the rate limiting middleware from PR #767 works per-user. Use the project's test utilities.


Generated by CEO Planner (priority: 3)

In `tests/generate/rate-limit.test.ts` (or create it), add test cases: 1. Authenticate as a test user 2. Send 5 rapid POST requests to `/api/generate` with valid payloads (match the configured rate limit threshold) 3. Verify the first N requests return 200 4. Verify the (N+1)th request returns 429 Too Many Requests 5. Verify the 429 response includes `Retry-After` header or `{ error: 'Rate limit exceeded' }` body This validates the rate limiting middleware from PR #767 works per-user. Use the project's test utilities. --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#1031
No description provided.