Files
bookhoard/bruno/collections/Test Collection Rules - Empty Rules Array.bru
T
john-okeefe 26070e4000 Refactor: rename baseUrl to base_url in .bru files
Update configuration key naming convention to use snake_case
consistently.
Applies changes recursively across all subdirectories.
2026-02-08 21:26:31 -05:00

49 lines
1023 B
Plaintext

meta {
name: Test Collection Rules - Empty Rules Array
type: http
seq: 5
}
post {
url: {{base_url}}/api/collections/test-rules
body: json
auth: inherit
}
headers {
Content-Type: application/json
Authorization: Bearer {{authToken}}
}
body:json {
{
"rules": []
}
}
script:post-response {
function onResponse(res) {
tests['Empty rules rejected'] = res.getStatus() === 400;
}
onResponse(res);
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Test Collection Rules - Empty Rules Array
Tests validation behavior when providing an empty rules array.
**Expected Result:** 400 Bad Request
**Validation Rule:** rules array must contain at least one rule object.
**Purpose:** Ensures the API properly validates input and rejects empty rule sets, preventing accidental queries that would return all books or cause performance issues.
**Use Case:** Client-side validation should prevent sending empty rules, but the API should also validate to catch malformed requests.
}