Skip to content

[v0.3] Specify behavior for fields#delete, fields#get-and-delete with invalid field name #783

Open

Description

@wingo

Consider:

    /// Delete all values for a name. Does nothing if no values for the name
    /// exist.
    ///
    /// Fails with `header-error.immutable` if the `fields` are immutable.
    delete: func(name: field-name) -> result<_, header-error>;
    /// Delete all values for a name. Does nothing if no values for the name
    /// exist.
    ///
    /// Returns all values previously corresponding to the name, if any.
    ///
    /// Fails with `header-error.immutable` if the `fields` are immutable.
    get-and-delete: func(name: field-name) -> result<list<field-value>, header-error>;

When passed an invalid field name, delete could silently succeed (like get does), because by definition there is no field with that name; the operation will not set any field of the fields object. Or it could return an invalid-syntax error, because it has the Result. Wasmtime currently returns an error.

Similar concerns for get-and-delete; I guess it should be specified as propagating any error, as if get() then delete().

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