Test scenarios
This page provides a curated collection of practical test scenarios for reference. Each scenario is written to reflect real-world testing situations faced during API, application, and integration testing.
These examples help testers cover happy paths, identify edge cases, and structure their test coverage more effectively. Use these scenarios as a starting point to design, review, or strengthen your own test cases across different systems and workflows.
API Header
API headers control how a request is interpreted, secured, and processed. Yet, in many test plans, headers are validated only at a surface level.
This article expands on some essiential scenarios with why they matter with real API examples. You can include these in your testing strategy.
Why header validation deserves attention
Headers are not optional metadata. They define authentication, content parsing, response format, and request limits.
A request may look correct but fail silently because of:
- Incorrect Content-Type
- Unsupported Accept values
- Oversized or duplicated headers
- Hidden defaults applied by clients or gateways
These issues often surface only in production if not tested intentionally.
Deeper Look at the Core Header Scenarios
Scenario 1. Extra or Unexpected Headers
APIs often receive headers added by proxies, gateways, or browsers.
A robust API should ignore unknown headers safely. Failing on unexpected headers creates fragile integrations and client-specific bugs.
Example: A request includes X-Debug-Mode: true. The API should process the request normally unless the header is explicitly supported.
Scenario 2. Unsupported Content-Type
Content-Type tells the server how to parse the request body.
If the API expects JSON but receives text/plain, it should fail fast with 415 Unsupported Media Type.
Example: Sending a JSON body with Content-Type: text/plain must not be parsed accidentally.
Scenario 3. Missing Content-Type
Some clients forget to send Content-Type altogether.
This scenario must be tested because:
- Silent defaults can cause incorrect parsing
- Different environments may behave differently
A clear rejection or safe default behavior is critical.
Scenario 4. Incorrect Accept Header
The Accept header defines what response formats the client can handle.
If the API cannot return the requested format, it should respond with 406 Not Acceptable.
Example: Client sends Accept: application/xml, but the API supports only JSON.
Scenario 5. Large Header Values
Headers have size limits enforced by servers and gateways.
Oversized tokens or metadata can cause:
- Request rejection
- Performance degradation
- Security risks
Example:An unusually large Authorization token should return431 Request Header Fields Too Large.
Scenario 6. Duplicate Headers
Some clients or libraries accidentally send headers multiple times.
APIs must follow a consistent rule:
- Use first value
- Use last value
- Reject the request
Inconsistent handling leads to unpredictable behavior.
Scenario 7. Header Case Variations
HTTP headers are defined as case-insensitive, but real implementations don’t always behave consistently.
Some backend frameworks, gateways, or custom middleware incorrectly treat headers as case-sensitive.
Example: Send content-type instead of Content-Type.The API should still correctly parse the request body.
Why test this:It prevents environment-specific bugs and ensures compatibility across different clients and tools.
Scenario 8. Empty Header Values
A header may be present but carry no value.
This is different from a missing header and should be handled intentionally.
Example: Accept: or Content-Type:
Expected behavior: The API should reject the request or apply a safe default with a clear response.
Why test this: Silent acceptance often leads to unexpected parsing or response behavior.
Scenario 9. Malformed Header Values
Headers can be syntactically present but structurally invalid.
Example:
- Authorization: Bearer (missing token)
- Accept application/json (missing colon)
Expected behavior: The API should return a clear validation error, not process the request.
Why test this: Malformed headers can break parsers or bypass validations if not checked properly.
Scenario 10. Special Characters in Headers
Header values must follow specific character rules.
Control characters, newlines, or unsupported symbols should never be accepted.
Example:Authorization: Bearer abc\nxyz
Expected behavior: The API should block the request and return a 400 Bad Request.
Why test this: This protects against header injection and request-smuggling vulnerabilities.
Scenario 11. CORS-Related Headers
For browser-based clients, headers interact with Cross-Origin Resource Sharing (CORS) rules.
Missing or misconfigured CORS headers can cause failures even when the API logic is correct.
Example:
- Missing Access-Control-Allow-Headers
- Invalid Access-Control-Allow-Origin
Expected behavior: The API should allow or block requests as per defined CORS policy.
Why test this:It avoids the classic “works in Postman, fails in browser” problem.
Scenario 12. Gateway or Proxy-Injected Headers
API gateways and proxies often add headers automatically.
Examples include:
- X-Forwarded-For
- X-Forwarded-Proto
- Host
Example: A client tries to manipulate X-Forwarded-For to spoof IP addresses.
Expected behavior: The API should validate or ignore these headers safely.
Why test this: Improper handling can lead to security loopholes and incorrect logging or routing.
Scenario 13. Conflicting Headers
Some headers can conflict with each other or with the request body.
Example: Content-Type: application/json but body contains XML.
Expected behavior:The API should reject the request with a clear error.
Why test this: Conflicts often lead to undefined behavior or partial parsing.
How This Helps in Real API Testing
By testing headers intentionally, you:
- Catch integration failures early
- Improve API robustness
- Ensure predictable error responses
- Reduce environment-specific bugs
Header validation fits perfectly into data-driven API testing, where multiple header combinations are executed in a single run.
Tools like BusStop help testers validate headers without scripting, execute bulk scenarios, and focus on behavior instead of setup.
Related topics
Like what you read?
Be updated with feature updates, promotional offers, latest content and more from BusStop - API testing tool.
URL Validation
API Header