I'm looking at cowl in relation to buttercup/buttercup-core#229, and it is tough to know the best way to migrate from fetch. It's also tough to know what the advantages are of cowl over fetch from the readme.
Here are the possible options for fetch.
method: 'POST', // *GET, POST, PUT, DELETE, etc.
mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit
headers: {
'Content-Type': 'application/json'
// 'Content-Type': 'application/x-www-form-urlencoded',
},
redirect: 'follow', // manual, *follow, error
referrer: 'no-referrer', // no-referrer, *client
body: JSON.stringify(data) // body data type must match "Content-Type" header
As I understand it, mode, cache, credentials, redirect, and referrer do not have analogs in cowl. Is this correct?
For responses, the API seems pretty straightforward, with the only difference that cowl stores the body in a buffer and that it does not automatically parse the body given the response type.
Also, fetch has some logic under the hood to do things like guess the Content-Type and Content-Length - are these present in cowl?
In general, what would be the main advantages of using cowl over fetch? Because fetch is battle-tested, has very few bugs, and will be known by most new contributors to a JS project, one would need IMO a pretty compelling reason to migrate to something new. Not saying that cowl lacks this, but rather that it is not apparent what the advantages are when reading the README.
I'm looking at
cowlin relation to buttercup/buttercup-core#229, and it is tough to know the best way to migrate from fetch. It's also tough to know what the advantages are ofcowloverfetchfrom the readme.Here are the possible options for fetch.
As I understand it,
mode,cache,credentials,redirect, andreferrerdo not have analogs in cowl. Is this correct?For responses, the API seems pretty straightforward, with the only difference that
cowlstores the body in a buffer and that it does not automatically parse the body given the response type.Also, fetch has some logic under the hood to do things like guess the
Content-TypeandContent-Length- are these present incowl?In general, what would be the main advantages of using
cowloverfetch? Becausefetchis battle-tested, has very few bugs, and will be known by most new contributors to a JS project, one would need IMO a pretty compelling reason to migrate to something new. Not saying thatcowllacks this, but rather that it is not apparent what the advantages are when reading the README.