curl-to-go
curl-to-go copied to clipboard
Add checks for http status code
I think it is better to add in the generated sample code a check (even if commented) for HTTP status code (just as a hint). example:
if resp.StatusCode != http.StatusOK {
// handle status code not 200
}
BTW, I spent long time not sure what is the error until I realized at the end that, the status code check is not there 😄
Maybe if resp.StatusCode >= 400 is more suitable. But yeah, that's a reasonable idea.
at end of the day, it is a hint for the developer that not to forget such checks