| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Greptile SummaryThis PR replaces generated raw HTTP status numbers with net/http constants. It changes:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "Use net/http constants in boilerplate" | Re-trigger Greptile |
Sorry, something went wrong.
Closes: oapi-codegen#2397 Replace raw integer literals in generated strict server code with named net/http constants (e.g. http.StatusOK instead of 200). Covers WriteHeader/Status/StatusCode calls in all strict server templates and status code comparisons in generated client switch statements. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
|
@greptileai, please look again, comments addressed. |
Sorry, something went wrong.
| return httpStatusConstant(r.StatusCode) | ||
| } | ||
|
|
||
| func httpStatusConstant(code string) string { |
There was a problem hiding this comment.
Might be worth a test to help us catch when new statuses are added to the standard library, if straightforward?
Sorry, something went wrong.
There was a problem hiding this comment.
We'd have to grep the standard library source. I think being lazy here is ok. The fallback to not using the constant will work, and we can address as-needed.
Sorry, something went wrong.
There was a problem hiding this comment.
Agreed this doesn't really provide too much additional value, but it can help consistency that a lot of folks' "production code" would do
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Closes: #2397
Replace raw integer literals in generated strict server code with named net/http constants (e.g. http.StatusOK instead of 200). Covers WriteHeader/Status/StatusCode calls in all strict server templates and status code comparisons in generated client switch statements.