What you will learn
You have already read response headers and rebuilt an Accept header. Now compare both message directions. Content-Type labels the body in that particular message. Accept expresses the response format the client prefers; the server contract decides what is supported.
Your goals
- Send JSON with explicit request format and response preference.
- Explain which body each header describes.
Before you start
Read the previous lesson first if you have not already. This course does not require programming.
Practice setup
These requests use the public TestKru teaching API. No workspace is needed unless a step says so. Leave the body empty for GET, HEAD and OPTIONS. Example people and emails are fictional. Changes to /api/users are simulated and are not saved.
Follow these steps
- Prepare POST /api/echo with the supplied JSON body. Add both Content-Type: application/json and Accept: application/json in Headers.
- Before sending, identify the body you are labelling with Content-Type and the response format you are requesting with Accept.
- Send and select the response. Inspect its Content-Type separately from your outgoing Content-Type.
- Answer the two direction questions and submit. Echo does not prove this API supports every Accept value.
Investigate before concluding
First record the actual result for each case. Compare the body, headers and later state with the stated contract. Keep an observation separate from a prediction; use the model answer only after making your own attempt.
What to keep as evidence
- Header direction is correct.
- Equivalent body values are compared.
- Legacy and strict expectations are separated.
References for this lesson
Finish this assignment
Select each named response with Use this response. Answer from those responses or the transcript on this page. Click Submit Answers. Your score is the percentage of checks that passed. Core checks are required to finish. Extra evidence checks are labelled. A saved 100/100 means every check passed. Continue opens the next lesson you can submit.
If something goes wrong
- Change one part of the request at a time. If a check needs attention, read the note under it and compare it with the response you selected.
Self-review and independent variation
- Header direction is correct.
- Equivalent body values are compared.
- Legacy and strict expectations are separated.
Ask for JSON while sending a JSON POST: explain the independent roles of the two headers.
Automatic checks verify the requests and answers configured for this lesson. The self-review is for your own reasoning. A score is not a certificate.