MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestFeedback_RateLimit

Function TestFeedback_RateLimit

internal/agent/api_test.go:219–239  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

217}
218
219func TestFeedback_RateLimit(t *testing.T) {
220 server, _, _ := setupAPI(t)
221
222 // Send 10 requests (the limit)
223 for i := 0; i < 10; i++ {
224 payload := fmt.Sprintf(`{"message":"feedback %d"}`, i)
225 resp, _ := http.Post(server.URL+"/api/feedback", "application/json", bytes.NewBufferString(payload))
226 resp.Body.Close()
227 if resp.StatusCode != 200 {
228 t.Fatalf("request %d: status = %d, want 200", i, resp.StatusCode)
229 }
230 }
231
232 // 11th request should be rate limited
233 resp, _ := http.Post(server.URL+"/api/feedback", "application/json", bytes.NewBufferString(`{"message":"one too many"}`))
234 defer resp.Body.Close()
235
236 if resp.StatusCode != 429 {
237 t.Errorf("status = %d, want 429 for rate-limited request", resp.StatusCode)
238 }
239}
240
241func TestFeedback_OptionalEmail(t *testing.T) {
242 server, _, _ := setupAPI(t)

Callers

nothing calls this directly

Calls 2

setupAPIFunction · 0.85
CloseMethod · 0.45

Tested by

no test coverage detected