Aşağıdaki gibi açısal kullanarak bir http isteği gönderiyorum.
$http({
url: url,
params: params,
method:'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
},
timeout: 60000 //60 seconds
}).success(function(data, status, headers, config) {
//do something
}).error(function(data, status, header, config) {
if(timedout){ //determine occurrence of timeout.
//invoke timeout handler
} else
//handle other error
}
});
Zaman aşımını nasıl belirleyebilirim?
Bu durumda "0" durum kodu alındığını gözlemledim. Zaman aşımı için status == 0 kontrol etmek güvenli midir?
Lütfen HTTP İstek zaman aşımını (durum kodu 408) sormuyorum.
Tek bildiğim, 'status === 0' ** **' nin bir zaman aşımını sembolize etmemesidir. t doğru bir HTTP durumuyla cevap verin, ya da uzun boylu. – Blackhole
Ayrıca bir aramanın iptal edildiği durumdur. – Francisc