File tree Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ var jsc = jQuery.now(),
4
4
rscript = / < s c r i p t \b [ ^ < ] * (?: (? ! < \/ s c r i p t > ) < [ ^ < ] * ) * < \/ s c r i p t > / gi,
5
5
rselectTextarea = / ^ (?: s e l e c t | t e x t a r e a ) / i,
6
6
rinput = / ^ (?: c o l o r | d a t e | d a t e t i m e | e m a i l | h i d d e n | m o n t h | n u m b e r | p a s s w o r d | r a n g e | s e a r c h | t e l | t e x t | t i m e | u r l | w e e k ) $ / i,
7
- rnoContent = / ^ (?: G E T | H E A D | D E L E T E ) $ / ,
7
+ rnoContent = / ^ (?: G E T | H E A D ) $ / ,
8
8
rbracket = / \[ \] $ / ,
9
9
jsre = / \= \? ( & | $ ) / ,
10
10
rquery = / \? / ,
@@ -271,7 +271,7 @@ jQuery.extend({
271
271
s . cache = false ;
272
272
}
273
273
274
- if ( s . cache === false && type === "GET" ) {
274
+ if ( s . cache === false && noContent ) {
275
275
var ts = jQuery . now ( ) ;
276
276
277
277
// try replacing _= if it is there
@@ -281,8 +281,8 @@ jQuery.extend({
281
281
s . url = ret + ( ( ret === s . url ) ? ( rquery . test ( s . url ) ? "&" : "?" ) + "_=" + ts : "" ) ;
282
282
}
283
283
284
- // If data is available, append data to url for get requests
285
- if ( s . data && type === "GET" ) {
284
+ // If data is available, append data to url for GET/HEAD requests
285
+ if ( s . data && noContent ) {
286
286
s . url += ( rquery . test ( s . url ) ? "&" : "?" ) + s . data ;
287
287
}
288
288
Original file line number Diff line number Diff line change @@ -289,6 +289,32 @@ test("jQuery.ajax - xml: non-namespace elements inside namespaced elements", fun
289
289
} ) ;
290
290
} ) ;
291
291
292
+ test ( "jQuery.ajax - HEAD requests" , function ( ) {
293
+ expect ( 2 ) ;
294
+
295
+ stop ( ) ;
296
+ jQuery . ajax ( {
297
+ url : url ( "data/name.html" ) ,
298
+ type : "HEAD" ,
299
+ success : function ( data , status , xhr ) {
300
+ var h = xhr . getAllResponseHeaders ( ) ;
301
+ ok ( / D a t e / i. test ( h ) , 'No Date in HEAD response' ) ;
302
+
303
+ jQuery . ajax ( {
304
+ url : url ( "data/name.html" ) ,
305
+ data : { whip_it : "good" } ,
306
+ type : "HEAD" ,
307
+ success : function ( data , status , xhr ) {
308
+ var h = xhr . getAllResponseHeaders ( ) ;
309
+ ok ( / D a t e / i. test ( h ) , 'No Date in HEAD response with data' ) ;
310
+ start ( ) ;
311
+ }
312
+ } ) ;
313
+ }
314
+ } ) ;
315
+
316
+ } ) ;
317
+
292
318
test ( "jQuery.ajax - beforeSend" , function ( ) {
293
319
expect ( 1 ) ;
294
320
stop ( ) ;
You can’t perform that action at this time.
0 commit comments