Changes between Initial Version and Version 2 of Ticket #13491
- Timestamp:
- Feb 21, 2013, 6:20:04 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #13491
-
Property
Status
changed from
new
toclosed
-
Property
Resolution
changed from
to
notabug
-
Property
Status
changed from
-
Ticket #13491 – Description
initial v2 7 7 It instead sends a header with an empty value. 8 8 9 10 9 The code at fault is: 11 10 11 {{{#!js 12 12 // X-Requested-With header 13 13 // For cross-domain requests, seeing as conditions for a preflight are … … 17 17 if(!s.crossDomain && !headers["X-Requested-With"]) 18 18 headers["X-Requested-With"] = "XMLHttpRequest"; 19 }}} 19 20 20 21 which is immediately followed by 21 22 23 {{{#!js 22 24 for(i in headers) 23 25 xhr.setRequestHeader(i, headers[i]); 24 26 xhr.send(); 27 }}} 25 28 26 29 This means there is NO WAY to suppress the header from being sent on same-origin requests. … … 29 32 I would like to request one or two of these three changes which would allow this: 30 33 31 1 )some flag that can be set to true in .ajaxSetup(), default to send (i.e. no change to current behaviour by default):34 1. some flag that can be set to true in .ajaxSetup(), default to send (i.e. no change to current behaviour by default): 32 35 36 {{{#!js 33 37 if(!s.crossDomain && !headers["X-Requested-With"] && !s.suppressRequestedWithHeader) 34 38 headers["X-Requested-With"] = "XMLHttpRequest"; 39 }}} 35 40 36 2 )some flag that can be set to true in .ajaxSetup(), default to not send (i.e. reduces unnecessary internet traffic):41 2. some flag that can be set to true in .ajaxSetup(), default to not send (i.e. reduces unnecessary internet traffic): 37 42 43 {{{#!js 38 44 if(!s.crossDomain && !headers["X-Requested-With"] && s.sendRequestedWithHeader) 39 45 headers["X-Requested-With"] = "XMLHttpRequest"; 46 }}} 40 47 41 3 )[not exclusive with 1 or 2] Validate that headers set have non-empty values:48 3. [not exclusive with 1 or 2] Validate that headers set have non-empty values: 42 49 50 {{{#!js 43 51 for(i in headers) 44 52 if(headers[i] != '') 45 53 xhr.setRequestHeader(i, headers[i]); 46 54 xhr.send(); 55 }}} 47 56 48 This will allow jqXHR.setRequestHeader('X-Requested-With','')to suppress the header (rather than use a boolean).57 This will allow `jqXHR.setRequestHeader('X-Requested-With','')` to suppress the header (rather than use a boolean). 49 58 50 59 I would like #2 and #3 but I'd understand if you went with #1 and #3. Only doing #1 would be the most conservative and least helpful (barring of course, not fixing this bug!).