AJAX: Dynamically modifying the options.dataType in an ajaxPrefilter doesn't trigger the correct ajax converter.
|Reported by:||ralphholzmann||Owned by:|
I'm writing an app against a backend that I don't have access to. The backend is returning data in the wrong format, so I need to modify the data returned from the server for every request before it passes it along to the ajax success callback.
So I set up an ajax converter that will make the necessary modifications under the dataType "json fix", and it works great! \o/.
However, rather than go through my entire app and change the dataType for each ajax request, I thought it would be easier to set up an ajax prefilter that checks if the dataType is json, and if it is, adds " fix" to the dataType, thus triggering the converter. Unfortunately, this doesn't work. It works fine if I have the dataType originally set to "json fix", but dynamically adding it via an ajax prefilter does not work. :(
Test case: http://jsfiddle.net/DtpsB/1/