synapsestudios / fetch-client

http client library based on fetch
MIT License
9 stars 3 forks source link

Remove event emitter stuff #122

Open spruce-bruce opened 4 years ago

spruce-bruce commented 4 years ago

The response object returned by fetch can not be interacted with without mutating it. IE response.json() can only ever succeed once. Therefore, the event emitter pattern we use is inherently unsafe because you can't really control the order in which your event handlers are called. You won't know if your response.body has been read or not.

We just need to double down on the "plugin" thing for now, and probably evaluate the plugin interface in the future. For example the "helper" functions are dumb and should go away