Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add checks for http status code #51

Open
mhewedy opened this issue Dec 12, 2021 · 2 comments
Open

Add checks for http status code #51

mhewedy opened this issue Dec 12, 2021 · 2 comments

Comments

@mhewedy
Copy link

mhewedy commented Dec 12, 2021

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 😄

@mholt
Copy link
Owner

mholt commented Dec 13, 2021

Maybe if resp.StatusCode >= 400 is more suitable. But yeah, that's a reasonable idea.

@mhewedy
Copy link
Author

mhewedy commented Dec 13, 2021

at end of the day, it is a hint for the developer that not to forget such checks

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants