Skip to content

Specify range of valid HTTP response codes #849

Open

Description

@wingo

What is the domain of wasi:http/response#set-status-code ?

RFC 9110 specifies the set of HTTP status codes, divided in 5 blocks (100-199, 200-299, 300-399, 400-499, 500-599), and specifies that new status codes should fall in those blocks.

Proposal: codes should be in the range 100-599.

FWIW, Rust's http crate allows 100-999, while "discouraging" codes 600 or above: https://github.com/hyperium/http/blob/master/src/status.rs#L73.

Activity

  1. igrep commented on Dec 10, 2025

    @igrep
    Contributor

    Doesn't it need to accept unofficially used status codes (such as 999)?

  2. wingo commented on Dec 11, 2025

    @wingo
    ContributorAuthor

    In the abstract it is better to use a field for that purpose, as fields are the extensible part of a response. Obviously if the use of e.g. 999 is widely-deployed we probably need to support it.

    Interestingly I just read WhatWG fetch's specification, which allows 0..=999: https://fetch.spec.whatwg.org/#concept-status

    I still think 100..-=599 is the right choice though if we manage to make it stick.

  3. yoshuawuyts commented on Dec 16, 2025

    @yoshuawuyts
    Member

    cc/ @WebAssembly/wasi-http-champions

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-httpProposal: wasi-http

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions