Skip to content

Deprecate size option #1438

@jimmywarting

Description

@jimmywarting

The size option have always been a node-fetch only option. It's not in the spec.
So I would like to deprecate/remove it also.

Describe the solution you'd like

In the attempts to align with the spec more correctly and having code that works the same way across undici, deno, browsers and node-fetch i would like for the size option to go away into a own separate user-land module.

Limiting the size can be tricky

  • it should really be using AbortController / AbortSignal to abort the request.
  • it needs to check content-length and take compression into consideration.
  • when no content-length is available it should stream & calculate & abort when exceeding.
  • weather or not it should handle redirects manually.

Describe alternatives you've considered

  • a own seperate module for handling size (similar to how we did it with timeout and provided a timer-signal)
  • Another possible solution is if we where to have fetchObserver and/or fetchEvent then one could also use AbortController to abort request in another way

Additional context

No other fetch impl have size limit

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions