Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
eb47553e
Commit
eb47553e
authored
Jan 24, 2013
by
byroot
Committed by
jaubourg
Jan 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't try and convert data for 204 No Content responses. Fixes #13292. Fixes #13261.
parent
21af3a92
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
3 deletions
+33
-3
ajax.js
src/ajax.js
+8
-3
nocontent.php
test/data/nocontent.php
+5
-0
ajax.js
test/unit/ajax.js
+20
-0
No files found.
src/ajax.js
View file @
eb47553e
...
@@ -624,12 +624,17 @@ jQuery.extend({
...
@@ -624,12 +624,17 @@ jQuery.extend({
}
}
}
}
// If not modified
// if no content
if
(
status
===
304
)
{
if
(
status
===
204
)
{
isSuccess
=
true
;
statusText
=
"nocontent"
;
// if not modified
}
else
if
(
status
===
304
)
{
isSuccess
=
true
;
isSuccess
=
true
;
statusText
=
"notmodified"
;
statusText
=
"notmodified"
;
// If we have data
// If we have data
, let's convert it
}
else
{
}
else
{
isSuccess
=
ajaxConvert
(
s
,
response
);
isSuccess
=
ajaxConvert
(
s
,
response
);
statusText
=
isSuccess
.
state
;
statusText
=
isSuccess
.
state
;
...
...
test/data/nocontent.php
0 → 100644
View file @
eb47553e
<?php
header
(
'HTTP/1.0 204 No Content'
);
?>
\ No newline at end of file
test/unit/ajax.js
View file @
eb47553e
...
@@ -1498,6 +1498,26 @@ module( "ajax", {
...
@@ -1498,6 +1498,26 @@ module( "ajax", {
strictEqual
(
ajaxXML
.
find
(
"tab"
).
length
,
3
,
"Parsed node was added properly"
);
strictEqual
(
ajaxXML
.
find
(
"tab"
).
length
,
3
,
"Parsed node was added properly"
);
}
}
});
});
ajaxTest
(
"#13292 - jQuery.ajax() - converter is bypassed for 204 requests"
,
3
,
{
url
:
"data/nocontent.php"
,
dataType
:
"testing"
,
converters
:
{
"* testing"
:
function
()
{
throw
"converter was called"
;
}
},
success
:
function
(
data
,
status
,
jqXHR
)
{
strictEqual
(
jqXHR
.
status
,
204
,
"status code is 204"
);
strictEqual
(
status
,
"nocontent"
,
"status text is 'nocontent'"
);
strictEqual
(
data
,
undefined
,
"data is undefined"
);
},
error
:
function
(
_
,
status
,
error
)
{
ok
(
false
,
"error"
);
strictEqual
(
status
,
"parsererror"
,
"Parser Error"
);
strictEqual
(
error
,
"converter was called"
,
"Converter was called"
);
}
});
//----------- jQuery.ajaxPrefilter()
//----------- jQuery.ajaxPrefilter()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment