Resolve promise if xhr status code is between 200 and 399, else reject

The `load` event is triggered regardless of the server response code. An `error` event is triggered if the request fails (like when a connection is unavailable).

With the changes in this PR, we'll only resolve the promise if the response status code is between `200` and `399.` Otherwise, we'll reject the promise.