Check status code of invocation response

If the invocation returns a non-200 status code, you get an error from trying to parse an invalid response body (in my case a 401, I'd forgotten to add the credentials).