Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions reqwest.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@
}

function success (resp) {
var type = o['type'] || setType(resp.getResponseHeader('Content-Type'))
var type = o['type']
if (resp) {
type = setType(resp.getResponseHeader('Content-Type'))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

means o['type'] will always be thrown away in favour of the response's type, whereas previously it trumped it. Maybe something (ugly) like

var type = o['type'] || ( resp && setType(resp.getResponseHeader('Content-Type')))

resp = (type !== 'jsonp') ? self.request : resp
// use global data filter on response text
var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type)
Expand Down Expand Up @@ -411,9 +414,6 @@
}
return this
}
, catch: function (fn) {
return this.fail(fn)
}
}

function reqwest(o, fn) {
Expand Down