| 252 | } |
| 253 | |
| 254 | func TestFeedback_EmailTooLong(t *testing.T) { |
| 255 | server, _, _ := setupAPI(t) |
| 256 | |
| 257 | longEmail := string(bytes.Repeat([]byte("a"), 255)) + "@example.com" |
| 258 | payload := fmt.Sprintf(`{"message":"test","email":"%s"}`, longEmail) |
| 259 | resp, _ := http.Post(server.URL+"/api/feedback", "application/json", bytes.NewBufferString(payload)) |
| 260 | defer resp.Body.Close() |
| 261 | |
| 262 | if resp.StatusCode != 400 { |
| 263 | t.Errorf("status = %d, want 400 for email too long", resp.StatusCode) |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | func TestFeedback_OversizedBody(t *testing.T) { |
| 268 | server, _, _ := setupAPI(t) |