Checks whether the input can be handled by this class. If it cannot handle the input, rejects with an error explaining why.
Input that could potentially be handled.
A promise resolving if the input can be handled, rejecting with an Error if not.
Handles the given input. This may only be called if canHandle did not reject. When unconditionally calling both in sequence, consider handleSafe instead.
Input that needs to be handled.
A promise resolving when handling is finished.
Helper function that first runs canHandle followed by handle. Throws the error of canHandle if the data cannot be handled, or returns the result of handle otherwise.
Input data that will be handled if it can be handled.
A promise resolving if the input can be handled, rejecting with an Error if not.
A meta converter that takes an array of other converters as input. It chains these converters by finding a path of converters that can go from the given content-type to the given type preferences. In case there are multiple paths, the one with the highest weight gets found. Will error in case no path can be found.
This is not a TypedRepresentationConverter since the supported output types might depend on what is the input content-type.
This converter should be the last in a WaterfallHandler if there are multiple, since it will try to convert any representation with a content-type.
Some suggestions on how this class can be even more optimized should this ever be needed in the future. Most of these decrease computation time at the cost of more memory.