我的服务返回一个304但 jQuery Ajax 似乎将其转换为200 OK结果。
这是我的要求:
$.ajax({
url: '/api/items',
type: 'GET',
dataType: 'json',
contentType: 'application/json',
ifModified:true,
cache: false,
statusCode: {
304: function() {
alert("not modified"); // does not fire
}
},
complete: function (xhr, status) {
console.log(xhr.status); // 200
}
}
});
使用 Fiddler,我可以看到服务304正确返回。
为什么 jQuery 将其转换为200?