Skip to content

Add HttpStatusCode (net) #54

@vhrcgcom

Description

@vhrcgcom

Description

Implement HttpStatusCode as a ValueObject in the net module.

Spec: u16 in range 100–599

Implementation checklist

  • Create src/net/httpstatuscode.rs
  • Implement ValueObject trait
  • Add #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
  • Export from src/net/mod.rs and prelude
  • Unit tests: valid input · empty input · invalid format · normalisation
  • Doc comment with # Example block
  • Update status in ROADMAP.md from ⬜ to ✅

Implementation detail

Input / Output

Type Alias
Input u16 HttpStatusCodeInput
Output u16 HttpStatusCodeOutput

Normalization

None.

Validation

  • Must be in the range 100..=599.

Extra methods

  • is_informational() -> booltrue for 1xx codes.
  • is_success() -> booltrue for 2xx codes.
  • is_redirection() -> booltrue for 3xx codes.
  • is_client_error() -> booltrue for 4xx codes.
  • is_server_error() -> booltrue for 5xx codes.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions