cycle-fetch-driver icon indicating copy to clipboard operation
cycle-fetch-driver copied to clipboard

Disambiguate the request interface

Open secobarbital opened this issue 10 years ago • 2 comments

Currently the driver takes in either a string or an object with url, input, init keys. These keys were based on the function signature in the MDN documentation but they are not intuitive names and url does not exist in the MDN doc.

Discussion started in #6 /cc @teohhanhui

secobarbital avatar Oct 22 '15 19:10 secobarbital

How about the following sink interface:

(url: String) |
(args: [input: String|Request, init: Object]) |
(request: { args: [input: String|Request, init: Object], key: String })

That is, the user can pass a string, an array or an object. The string would be interpreted as the url, the array would be interpreted as an argument list for fetch, and an object would have an args field with the argument list for fetch with an optional key field with an arbitrary string key for response filtering.

On the source side, we would continue to attach the original request object to the response observable and allowing filtering by the key or the request object (JSON.stringify??).

secobarbital avatar Oct 22 '15 19:10 secobarbital

I agree.

fiatjaf avatar Feb 22 '16 23:02 fiatjaf