I have a REST Endpoint (java):
@GET
@Path("/test_timeout")
@Produces(MediaType.APPLICATION_JSON)
public Response testtimeout() {
log.info("start request");
return Response.status(408).entity("TIMEOUT").build();
}
And a function in my controller.js:
var url = 'http://' + host + '/test_timeout';
$http.get(url).
success(function(data, status, headers, config) {
if (status == '200') {
$scope.tour.readed = data;
} else {
$scope.showGrowlError("", data);
}
}).
error(function(data, status, headers, config) {
$scope.showGrowlError("", data);
});
If I make a request the requested url will be called 10 times:
14:36:52,509 INFO ... start request
14:36:52,536 INFO ... start request
14:36:52,549 INFO ... start request
14:36:52,558 INFO ... start request
14:36:52,569 INFO ... start request
14:36:52,576 INFO ... start request
14:36:52,586 INFO ... start request
14:36:52,592 INFO ... start request
14:36:52,598 INFO ... start request
14:36:52,605 INFO ... start request
After 10 requests the function error will be called with status 0.
It's happend only if the reponse was sending with status 408.
I think it is a bug, because the status 408 is a legal status code and the client want get a feedback if the request needs to long.
Sorry for my bad english.