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(),
44 rscript = / < s c r i p t \b [ ^ < ] * (?: (? ! < \/ s c r i p t > ) < [ ^ < ] * ) * < \/ s c r i p t > / gi,
55 rselectTextarea = / ^ (?: s e l e c t | t e x t a r e a ) / i,
66 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 ) $ / ,
88 rbracket = / \[ \] $ / ,
99 jsre = / \= \? ( & | $ ) / ,
1010 rquery = / \? / ,
@@ -271,7 +271,7 @@ jQuery.extend({
271271 s . cache = false ;
272272 }
273273
274- if ( s . cache === false && type === "GET" ) {
274+ if ( s . cache === false && noContent ) {
275275 var ts = jQuery . now ( ) ;
276276
277277 // try replacing _= if it is there
@@ -281,8 +281,8 @@ jQuery.extend({
281281 s . url = ret + ( ( ret === s . url ) ? ( rquery . test ( s . url ) ? "&" : "?" ) + "_=" + ts : "" ) ;
282282 }
283283
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 ) {
286286 s . url += ( rquery . test ( s . url ) ? "&" : "?" ) + s . data ;
287287 }
288288
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
289289 } ) ;
290290} ) ;
291291
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+
292318test ( "jQuery.ajax - beforeSend" , function ( ) {
293319 expect ( 1 ) ;
294320 stop ( ) ;
You can’t perform that action at this time.
0 commit comments