Reverse these two lines. I.e. do the status_code check before the json content comparison.