Explore Library
QuizAdvanced

Checking HTTP Status Codes

Learn how to verify a successful REST response using URLSession and HTTPURLResponse.

In a URLSession data task, how do you correctly confirm that a REST request returned a successful (2xx) HTTP status code before decoding the JSON?