Bird
0
0

Which header must you set in a Swift POST request to indicate the body contains JSON data?

easy📝 Conceptual Q2 of 15
iOS Swift - Networking
Which header must you set in a Swift POST request to indicate the body contains JSON data?
AAuthorization
BAccept-Encoding
CUser-Agent
DContent-Type
Step-by-Step Solution
Solution:
  1. Step 1: Identify header for body content type

    The "Content-Type" header tells the server the format of the data sent in the body.
  2. Step 2: Recognize JSON content type value

    For JSON, the value is "application/json".
  3. Final Answer:

    Content-Type -> Option D
  4. Quick Check:

    JSON body header = C [OK]
Quick Trick: Use Content-Type: application/json for JSON bodies [OK]
Common Mistakes:
  • Using Accept-Encoding instead of Content-Type
  • Omitting Content-Type header
  • Confusing Authorization with Content-Type

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes