Permalink
Browse files

rebuild and remove `onevar`. i kinda like non-onevar now

  • Loading branch information...
1 parent 2b751d2 commit e6d6cb282be9478f401e948fe2103ce259755ddb @ded committed Feb 24, 2014
Showing with 15 additions and 16 deletions.
  1. +1 −1 .jshintrc
  2. +1 −1 build.json
  3. +10 −11 reqwest.js
  4. +3 −3 reqwest.min.js
View
@@ -55,6 +55,6 @@
, "worker": true
, "wsh": false
, "nomen": false
- , "onevar": true
+ , "onevar": false
, "passfail": false
}
View
@@ -68,7 +68,7 @@
"worker": true,
"wsh": false,
"nomen": false,
- "onevar": true,
+ "onevar": false,
"passfail": false
}
}
View
@@ -1,6 +1,6 @@
-/*! version: 1.0.2
+/*!
* Reqwest! A general purpose XHR connection manager
- * license MIT (c) Dustin Diaz 2013
+ * license MIT (c) Dustin Diaz 2014
* https://github.com/ded/reqwest
*/
@@ -74,8 +74,7 @@
if (r._aborted) return error(r.request)
if (r.request && r.request[readyState] == 4) {
r.request.onreadystatechange = noop
- if (twoHundo.test(r.request.status))
- success(r.request)
+ if (twoHundo.test(r.request.status)) success(r.request)
else
error(r.request)
}
@@ -140,9 +139,6 @@
// need this for IE due to out-of-order onreadystatechange(), binding script
// execution to an event listener gives us control over when the script
// is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html
- //
- // if this hack is used in IE10 jsonp callback are never called
- script.event = 'onclick'
script.htmlFor = script.id = '_reqwest_' + reqId
}
@@ -229,9 +225,12 @@
init.apply(this, arguments)
}
- function setType(url) {
- var m = url.match(/\.(json|jsonp|html|xml)(\?|$)/)
- return m ? m[1] : 'js'
+ function setType(header) {
+ // json, javascript, text/plain, text/html, xml
+ if (header.match('json')) return 'json'
+ if (header.match('javascript')) return 'js'
+ if (header.match('text')) return 'html'
+ if (header.match('xml')) return 'xml'
}
function init(o, fn) {
@@ -253,7 +252,6 @@
this._responseArgs = {}
var self = this
- , type = o['type'] || setType(this.url)
fn = fn || function () {}
@@ -290,6 +288,7 @@
}
function success (resp) {
+ var type = o['type'] || 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)
Oops, something went wrong.

0 comments on commit e6d6cb2

Please sign in to comment.