在下面的 javascript 中,我想根据 http 错误代码来处理错误。可以处理所有其他类型的 http 错误,但不能处理 407,当服务器发送状态为 407 时,jqXHR.status 显示为“0”而不是“407”。知道为什么它不显示状态为 407 吗?是否有任何替代方法来处理客户端的 407 错误。
function handleError(jqXHR) {
if (jqXHR.status === 500) {
// Server side error
} else if (jqXHR.status === 404) {
// Not found
} else if (jqXHR.status === 407) {
// Proxy Authentication is required
// This is not working, when server send http status code as 407, client side it is recieved as 0
}
}