Testing labels (processContent and non-JSON)
brettz9 opened this issue · comments
At https://github.com/whitlockjc/path-loader/blob/master/test/test-loaders-browser.js#L121 , I see "should support non-JSON with options.processContent" as a condition, though the file indicated is actually JSON and there is no inclusion of options.processContent
. Similarly at https://github.com/whitlockjc/path-loader/blob/master/test/test-loaders-node.js#L164 (and https://github.com/whitlockjc/path-loader/blob/master/test/test-loaders-node.js#L100 there is a non-JSON file but it also has no options.processContent
).
This is a documentation issue. Originally the idea was to support JSON by default but I decided not to.
And options.processContent
was a part of that too?
That's what I'm talking about. options.processContent
is required if you want anything other than text.
I see what I did. Basically, I ended up implementing this in json-refs and it never landed in this project. I guess if it's not here now, we probably don't need it. Thoughts?
I could easily make this possible in path-loader.
At first, I could easily see leaving this up to the caller, json-refs
in my case. On the other, I do not want to hide the raw response being made so I think it should be here.
Actually, this only makes sense for HTTP loading. Not a big deal but I'm supporting it for HTTP.
Regarding your comment that options.processContent
is required if you want anything other than text...
I see that processContent
is required in json-refs if you want something other than a JSON object, but I guess you are talking about how you think it should work in path-loader.
Yeah, I support adding it here for HTTP loading. I think maybe that you ought to pass another argument to processContent
containing the raw response object, no?
Yup, that's what I'm doing.
Great...
This should be fixed. In fact, options.processContent
takes a callback so you can do things asynchronously.
All documentation was updated as well. Thanks for catching this.
Regarding taking a callback and the docs, that's awesome, thanks!