What you will learn
A missing field is not in the JSON. null is a value. An empty string is a different value. One request cannot cover all three.
Your goals
- Execute missing, null, empty and wrong-type name cases separately.
- Use a valid control to show the other fields are acceptable.
Before you start
Read the previous lesson first if you have not already. This course does not require programming.
Practice setup
Click Create workspace. Then log in as the fictional customer named in the steps. Use that practice token, not your CodeKru sign-in. Reset starts this lesson’s data over and invalidates its tokens.
Follow these steps
- Create this lesson’s workspace and log in as A. Use a fresh email in every case and keep all fields other than name valid.
- Send one create with no name key and select it. Send another with "name": null and select it. They are different JSON bodies.
- Send another with "name": "" and another with "name": 42. Select each separately. Type the body changes yourself after preparation.
- Send a valid name and new email as the positive control, leaving optional age out. Select its response.
- Compare all five responses, classify the missing key and submit. This is a five-row input partition table, not one request testing five conditions.
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
- The missing-name request does not contain a name field.
- The valid request shows the other fields would work.
- The two statuses are copied from the selected responses.
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.
- A 401 means the practice login token is missing or expired. Log in again in this workspace.
- A 409 on create means that fictional email is already used. Choose another email.
Self-review and independent variation
- The missing-name request does not contain a name field.
- The valid request shows the other fields would work.
- The two statuses are copied from the selected responses.
Send a valid name with spaces around it and compare the stored name with the text you typed.
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.