Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/reqwest.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
} catch (e) {
// can't assign this in IE<=8, just ignore
}
if (r) {
if (r || r == '') {
switch (type) {
case 'json':
try {
Expand Down
Empty file added tests/fixtures/empty.html
Empty file.
10 changes: 10 additions & 0 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,16 @@
})
})

test('empty resp string is passed to callback', function (complete) {
ajax({
url: '/tests/fixtures/empty.html'
, success: function (resp) {
ok(resp == '', 'resp object isn\'t empty string')
complete()
}
})
})

test('invalid JSON sets error on resp object', function (complete) {
ajax({
url: '/tests/fixtures/invalidJSON.json'
Expand Down