Make sure request succeeds before trying to decode body as json