dmitmel / ccloader3

MIT License
2 stars 4 forks source link

Ability to hijack a request and return a custom response #4

Closed ghost closed 4 years ago

dmitmel commented 4 years ago

While this should be easily doable when I add general-purpose resource pipeline hooks (beforeSend, prePatch, postPatch, finalFixes), I'm not entirely convinced this is useful in practice. What are the usecases?

ghost commented 4 years ago

Defining my own custom file format handler.

dmitmel commented 4 years ago

What do you mean?

ghost commented 4 years ago

Scratch that. If something makes a request, and that file does not exist on the filesystem, I would like to return a custom response that is not an error.

dmitmel commented 4 years ago

To be fair that's just the reworded version of the title, I understand what this system has to do, but that's not a use-case though. Anyway, my current opinion on this feature is: it can be implemented in ccloader directly, theoretically with a separate mod provided that programmable resource pipeline exists (I'd like to have this for Localize Me, but so far Localize Me works fine without it), but as there is no concrete use-case (yet?) this is not blocking the 3.0.0 release.

ghost commented 4 years ago

I intend on using this to implement djson fake file feature. It will dynamically generate a file that may or may not change each time the file is requested. The most immediate use case is dynamically generated map files.