Skip to content

Consider response.throwIfNotOk()Β #1679

@annevk

Description

@annevk

Python has https://requests.readthedocs.io/en/latest/_modules/requests/models/#Response.raise_for_status and it seems folks sometimes want something like that from fetch(). You can branch on response.ok already, but perhaps essentially asserting would be nicer?

(They really seem to expect it to reject automatically, but that's not something that makes sense for all callers.)

(Naming follows https://dom.spec.whatwg.org/#dom-abortsignal-throwifaborted.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions