The UPS Shipping API Returns 201
This is just a quick note about the UPS Shipping API (though I've got more to say about UPS—watch this space). The documentation has many flaws, one of which is that it gives you the wrong HTTP response code for a successful API call.
The UPS Shipping API responds with
201
, not200
. The docs are wrong.
The docs suggest that the UPS Shipping API returns 200
when a successful request is given. In fact, the response is 201
.
Any tests that assert that the returned status is 200
will therefore fail. If you're careless (like me, alas), you might not notice for a while that your request has been successful, despite a failing Jest test suite.
I attribute this error simply to carelessness on UPS's part. I'd feel less upset by it if it were a small startup or a private project, because mixing up 200
and 201
is easily done. But the fact that the error hasn't been spotted in UPS's documentation shows a lack of care and attention.