Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$http does not support status code 408 (timeout) #4806

@javix

Description

@javix

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions