Mithril's default extract
should be exposed so users can fall back on it
#2926
dead-claudia
started this conversation in
Ideas
Replies: 2 comments
-
I can't even tell based on the documentation on how to use extract for Mithriljs 2.0 |
Beta Was this translation helpful? Give feedback.
0 replies
-
@omenking Definitely file a separate issue. This is about a feature proposal, not a bug. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Mithril version: 2.0.4
Browser and OS: All
Project:
Is this something you're interested in implementing yourself? Yes
Description
Mithril has some pretty involved logic for
extract
, much of which is far from obvious (and involves years of bugs), and you can't use bothextract
anddeserialize
together.I suggest we package that up into a single
m.request.extract(xhr, opts)
such that we can defaultextract
tom.request.extract
.Why
It's a fairly common use case for people to want to only extract some requests specially, not all. Also, some may want to use Mithril's normal extract functionality, but also throw errors based on XHR headers or other out-of-band info on the XHR object itself prior to unwrapping.
I've seen this come up many times on Gitter.
Possible Implementation
It's a fairly straightforward refactor pulling this code out into a separate function that simply returns its result directly and updating
m.request
with something to this effect:Open Questions
Beta Was this translation helpful? Give feedback.
All reactions