1
1
/*!
2
- * vue-resource v1.3.5
2
+ * vue-resource v1.3.6
3
3
* https://github.com/pagekit/vue-resource
4
4
* Released under the MIT License.
5
5
*/
12
12
13
13
var RESOLVED = 0 ;
14
14
var REJECTED = 1 ;
15
- var PENDING = 2 ;
15
+ var PENDING = 2 ;
16
16
17
17
function Promise$1 ( executor ) {
18
18
@@ -78,9 +78,9 @@ Promise$1.race = function race(iterable) {
78
78
} ) ;
79
79
} ;
80
80
81
- var p$1 = Promise$1 . prototype ;
81
+ var p = Promise$1 . prototype ;
82
82
83
- p$1 . resolve = function resolve ( x ) {
83
+ p . resolve = function resolve ( x ) {
84
84
var promise = this ;
85
85
86
86
if ( promise . state === PENDING ) {
@@ -121,7 +121,7 @@ p$1.resolve = function resolve(x) {
121
121
}
122
122
} ;
123
123
124
- p$1 . reject = function reject ( reason ) {
124
+ p . reject = function reject ( reason ) {
125
125
var promise = this ;
126
126
127
127
if ( promise . state === PENDING ) {
@@ -135,7 +135,7 @@ p$1.reject = function reject(reason) {
135
135
}
136
136
} ;
137
137
138
- p$1 . notify = function notify ( ) {
138
+ p . notify = function notify ( ) {
139
139
var promise = this ;
140
140
141
141
nextTick ( function ( ) {
@@ -169,7 +169,7 @@ p$1.notify = function notify() {
169
169
} ) ;
170
170
} ;
171
171
172
- p$1 . then = function then ( onResolved , onRejected ) {
172
+ p . then = function then ( onResolved , onRejected ) {
173
173
var promise = this ;
174
174
175
175
return new Promise$1 ( function ( resolve , reject ) {
@@ -178,7 +178,7 @@ p$1.then = function then(onResolved, onRejected) {
178
178
} ) ;
179
179
} ;
180
180
181
- p$1 . catch = function ( onRejected ) {
181
+ p . catch = function ( onRejected ) {
182
182
return this . then ( undefined , onRejected ) ;
183
183
} ;
184
184
@@ -217,14 +217,14 @@ PromiseObj.race = function (iterable, context) {
217
217
return new PromiseObj ( Promise . race ( iterable ) , context ) ;
218
218
} ;
219
219
220
- var p = PromiseObj . prototype ;
220
+ var p$1 = PromiseObj . prototype ;
221
221
222
- p . bind = function ( context ) {
222
+ p$1 . bind = function ( context ) {
223
223
this . context = context ;
224
224
return this ;
225
225
} ;
226
226
227
- p . then = function ( fulfilled , rejected ) {
227
+ p$1 . then = function ( fulfilled , rejected ) {
228
228
229
229
if ( fulfilled && fulfilled . bind && this . context ) {
230
230
fulfilled = fulfilled . bind ( this . context ) ;
@@ -237,7 +237,7 @@ p.then = function (fulfilled, rejected) {
237
237
return new PromiseObj ( this . promise . then ( fulfilled , rejected ) , this . context ) ;
238
238
} ;
239
239
240
- p . catch = function ( rejected ) {
240
+ p$1 . catch = function ( rejected ) {
241
241
242
242
if ( rejected && rejected . bind && this . context ) {
243
243
rejected = rejected . bind ( this . context ) ;
@@ -246,15 +246,15 @@ p.catch = function (rejected) {
246
246
return new PromiseObj ( this . promise . catch ( rejected ) , this . context ) ;
247
247
} ;
248
248
249
- p . finally = function ( callback ) {
249
+ p$1 . finally = function ( callback ) {
250
250
251
251
return this . then ( function ( value ) {
252
- callback . call ( this ) ;
253
- return value ;
254
- } , function ( reason ) {
255
- callback . call ( this ) ;
256
- return Promise . reject ( reason ) ;
257
- }
252
+ callback . call ( this ) ;
253
+ return value ;
254
+ } , function ( reason ) {
255
+ callback . call ( this ) ;
256
+ return Promise . reject ( reason ) ;
257
+ }
258
258
) ;
259
259
} ;
260
260
@@ -507,7 +507,7 @@ function parse(template) {
507
507
return {
508
508
vars : variables ,
509
509
expand : function expand ( context ) {
510
- return template . replace ( / \{ ( [ ^ \{ \ }] + ) \} | ( [ ^ \{ \ }] + ) / g, function ( _ , expression , literal ) {
510
+ return template . replace ( / \{ ( [ ^ { } ] + ) \} | ( [ ^ { } ] + ) / g, function ( _ , expression , literal ) {
511
511
if ( expression ) {
512
512
513
513
var operator = null , values = [ ] ;
@@ -518,7 +518,7 @@ function parse(template) {
518
518
}
519
519
520
520
expression . split ( / , / g) . forEach ( function ( variable ) {
521
- var tmp = / ( [ ^ : \ *] * ) (?: : ( \d + ) | ( \* ) ) ? / . exec ( variable ) ;
521
+ var tmp = / ( [ ^ : * ] * ) (?: : ( \d + ) | ( \* ) ) ? / . exec ( variable ) ;
522
522
values . push . apply ( values , getValues ( context , operator , tmp [ 1 ] , tmp [ 2 ] || tmp [ 3 ] ) ) ;
523
523
variables . push ( tmp [ 1 ] ) ;
524
524
} ) ;
@@ -790,19 +790,19 @@ function xdrClient (request) {
790
790
return new PromiseObj ( function ( resolve ) {
791
791
792
792
var xdr = new XDomainRequest ( ) , handler = function ( ref ) {
793
- var type = ref . type ;
793
+ var type = ref . type ;
794
794
795
795
796
- var status = 0 ;
796
+ var status = 0 ;
797
797
798
- if ( type === 'load' ) {
799
- status = 200 ;
800
- } else if ( type === 'error' ) {
801
- status = 500 ;
802
- }
798
+ if ( type === 'load' ) {
799
+ status = 200 ;
800
+ } else if ( type === 'error' ) {
801
+ status = 500 ;
802
+ }
803
803
804
- resolve ( request . respondWith ( xdr . responseText , { status : status } ) ) ;
805
- } ;
804
+ resolve ( request . respondWith ( xdr . responseText , { status : status } ) ) ;
805
+ } ;
806
806
807
807
request . abort = function ( ) { return xdr . abort ( ) ; } ;
808
808
@@ -1035,19 +1035,18 @@ function xhrClient (request) {
1035
1035
1036
1036
var xhr = new XMLHttpRequest ( ) , handler = function ( event ) {
1037
1037
1038
- var response = request . respondWith (
1038
+ var response = request . respondWith (
1039
1039
'response' in xhr ? xhr . response : xhr . responseText , {
1040
1040
status : xhr . status === 1223 ? 204 : xhr . status , // IE9 status bug
1041
1041
statusText : xhr . status === 1223 ? 'No Content' : trim ( xhr . statusText )
1042
- }
1043
- ) ;
1042
+ } ) ;
1044
1043
1045
- each ( trim ( xhr . getAllResponseHeaders ( ) ) . split ( '\n' ) , function ( row ) {
1046
- response . headers . append ( row . slice ( 0 , row . indexOf ( ':' ) ) , row . slice ( row . indexOf ( ':' ) + 1 ) ) ;
1047
- } ) ;
1044
+ each ( trim ( xhr . getAllResponseHeaders ( ) ) . split ( '\n' ) , function ( row ) {
1045
+ response . headers . append ( row . slice ( 0 , row . indexOf ( ':' ) ) , row . slice ( row . indexOf ( ':' ) + 1 ) ) ;
1046
+ } ) ;
1048
1047
1049
- resolve ( response ) ;
1050
- } ;
1048
+ resolve ( response ) ;
1049
+ } ;
1051
1050
1052
1051
request . abort = function ( ) { return xhr . abort ( ) ; } ;
1053
1052
@@ -1111,10 +1110,9 @@ function nodeClient (request) {
1111
1110
client ( url , { body : body , method : method , headers : headers } ) . then ( handler = function ( resp ) {
1112
1111
1113
1112
var response = request . respondWith ( resp . body , {
1114
- status : resp . statusCode ,
1115
- statusText : trim ( resp . statusMessage )
1116
- }
1117
- ) ;
1113
+ status : resp . statusCode ,
1114
+ statusText : trim ( resp . statusMessage )
1115
+ } ) ;
1118
1116
1119
1117
each ( resp . headers , function ( value , name ) {
1120
1118
response . headers . set ( name , value ) ;
@@ -1226,7 +1224,7 @@ Headers.prototype.set = function set (name, value) {
1226
1224
this . map [ normalizeName ( getName ( this . map , name ) || name ) ] = [ trim ( value ) ] ;
1227
1225
} ;
1228
1226
1229
- Headers . prototype . append = function append ( name , value ) {
1227
+ Headers . prototype . append = function append ( name , value ) {
1230
1228
1231
1229
var list = this . map [ getName ( this . map , name ) ] ;
1232
1230
@@ -1237,11 +1235,11 @@ Headers.prototype.append = function append (name, value){
1237
1235
}
1238
1236
} ;
1239
1237
1240
- Headers . prototype . delete = function delete$1 ( name ) {
1238
+ Headers . prototype . delete = function delete$1 ( name ) {
1241
1239
delete this . map [ getName ( this . map , name ) ] ;
1242
1240
} ;
1243
1241
1244
- Headers . prototype . deleteAll = function deleteAll ( ) {
1242
+ Headers . prototype . deleteAll = function deleteAll ( ) {
1245
1243
this . map = { } ;
1246
1244
} ;
1247
1245
@@ -1261,7 +1259,7 @@ function getName(map, name) {
1261
1259
1262
1260
function normalizeName ( name ) {
1263
1261
1264
- if ( / [ ^ a - z 0 - 9 \- # $ % & ' * + . \ ^_ ` | ~ ] / i. test ( name ) ) {
1262
+ if ( / [ ^ a - z 0 - 9 \- # $ % & ' * + . ^ _ ` | ~ ] / i. test ( name ) ) {
1265
1263
throw new TypeError ( 'Invalid character in header field name' ) ;
1266
1264
}
1267
1265
@@ -1359,11 +1357,11 @@ var Request = function Request(options$$1) {
1359
1357
}
1360
1358
} ;
1361
1359
1362
- Request . prototype . getUrl = function getUrl ( ) {
1360
+ Request . prototype . getUrl = function getUrl ( ) {
1363
1361
return Url ( this ) ;
1364
1362
} ;
1365
1363
1366
- Request . prototype . getBody = function getBody ( ) {
1364
+ Request . prototype . getBody = function getBody ( ) {
1367
1365
return this . body ;
1368
1366
} ;
1369
1367
0 commit comments