Skip to content

feat(http): add HTTP status code constants#907

Merged
SchoolyB merged 1 commit into
SchoolyB:mainfrom
Scanf-s:feat/add-http-status-code
Jan 5, 2026
Merged

feat(http): add HTTP status code constants#907
SchoolyB merged 1 commit into
SchoolyB:mainfrom
Scanf-s:feat/add-http-status-code

Conversation

@Scanf-s

@Scanf-s Scanf-s commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolve #901 - Add user-facing HTTP status code constants

Add HTTP status code constants to allow more readable status code comparisons, usage instead of hard-coded integres.


Changes

Implemented constants

2xx: OK, CREATED, ACCEPTED, NO_CONTENT
3xx: MOVED_PERMANENTLY, FOUND, NOT_MODIFIED, TEMPORARY_REDIRECT, PERMANENT_REDIRECT
4xx: BAD_REQUEST, UNAUTHORIZED, PAYMENT_REQUIRED, FORBIDDEN, NOT_FOUND, METHOD_NOT_ALLOWED, CONFLICT
5xx: INTERNAL_SERVER_ERROR, BAD_GATEWAY, SERVICE_UNAVAILABLE

Example

In http.ez, Added some use HTTP status code use cases

...
if resp.status != http.OK {
        println("Request Failed: ${resp.status}")
        return
}
...
if post_resp.status != http.CREATED {
        println("Request Failed: ${post_err.message}")
        return
}
...

Test Results

Manual tests

스크린샷 2026-01-05 221808

Unit tests

스크린샷 2026-01-05 221843

Integration tests

스크린샷 2026-01-05 221857

Formatting

스크린샷 2026-01-05 221955

@SchoolyB SchoolyB left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @Scanf-s! LGTM 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(http): Add user-facing HTTP status code constants

2 participants