feat: Don't reject m.request Promise if extract callback supplied (#2006)

This commit is contained in:
spacejack 2017-11-13 11:08:54 -05:00 committed by Pat Cavit
parent e90f14ebe0
commit 80b6a1af0d
4 changed files with 36 additions and 3 deletions

View file

@ -88,7 +88,7 @@ module.exports = function($window, Promise) {
if (xhr.readyState === 4) {
try {
var response = (args.extract !== extract) ? args.extract(xhr, args) : args.deserialize(args.extract(xhr, args))
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304 || FILE_PROTOCOL_REGEX.test(args.url)) {
if (args.extract !== extract || (xhr.status >= 200 && xhr.status < 300) || xhr.status === 304 || FILE_PROTOCOL_REGEX.test(args.url)) {
resolve(cast(args.type, response))
}
else {