API testing · Headers
JSON response is labelled Content-Type: text/html
P3 · MinorBeginnerHeaders
Want to find it yourself first? This page gives away the answer. Play this bug on a fake app screen and see if you can spot it in three tries.
The clue
What kind of data is in the body?
Steps to reproduce
- Send GET /api/orders/88
- Compare the Content-Type header with the body
Expected result
Content-Type: application/json
Actual result
Content-Type: text/html; charset=utf-8
Why it matters
This is a minor (P3) bug. It does not stop anyone, but it looks careless and makes people trust the product less. It is usually fixed in a normal sprint.
Testing tip
Clients decide how to read a body from Content-Type. A wrong type can break parsing and opens doors to XSS.
How to find bugs like this
API bugs live in the JSON between the app and the server: wrong records returned, fields that leak private data, bad status codes and limits that are not enforced. When you test, try these checks:
- Read the whole response body, not only the status code.
- Ask for other users’ records on purpose.
- Look for fields that should never leave the server.
- Send values at and past every limit.