API testing

Assert the content-type header

Easy30 pts~12 min
  • Content negotiation
  • Headers
Practice app · Acme REST API

A live REST + GraphQL API with auth, validation, pagination, rate limiting and an interactive request console.

BASE_URL
/api/practice
Console app
/lab/api-testing-assert-the-content-type-header

Your starter code already declares BASE_URL — call the API relative to it.

Objective

Verify the API declares JSON in the Content-Type header before you parse the body.

Your task

  1. 1Send GET BASE_URL + "/users/1".
  2. 2Assert the status is 200.
  3. 3Assert Content-Type contains “application/json” (it may carry a charset suffix).

Acceptance criteria

  • GET /users/1 returns 200
  • At least 2 assertions pass (status and Content-Type)

Fixtures

apiKey
tqa_live_key_123
basicUser
admin
basicPassword
secret
username
qa@target.dev
password
Test@123

API testing · API Testing · HTTP fundamentals