0 Replies Latest reply on Apr 15, 2018 7:52 PM by fengd9946600

    URLLoader does not response http 301 status code

    fengd9946600

      Hi,

       

      I  develop with Air28 API and use urlloader in the client to send url request to my server, after some processes, the server reports status 301 code to the client and I don't think the events were be delivered properly. My code in the client as below:

       

        public function fetch(url:String, urlRequest:URLRequest = null, dataFormat:String = URLLoaderDataFormat.TEXT, followRedirect:Boolean = true):void {

        trace(LOG+"Fetching " + url);

        _urlRequest = urlRequest;

        if (_urlRequest == null) {

        _urlRequest = new URLRequest();

        setUserAgent();

        _urlRequest.manageCookies = true;

        _urlRequest.method = URLRequestMethod.GET;

        }

        _urlRequest.followRedirects = followRedirect;

        _urlRequest.url = url;

       

        var urlLoader:URLLoader = new URLLoader();

        urlLoader.addEventListener(Event.COMPLETE, handleComplete);

        urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);

        urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);

        urlLoader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, httpResponseStatusHandler);

        urlLoader.dataFormat = dataFormat;

        urlLoader.load(_urlRequest);

        }

       

      I've tried to response code 20x, 40x from the server, the events dispatching sequence at client side will be HTTP_RESPONSE_STATUS -> HTTP_STATUS -> COMPLETE which are all rights. But when response code 301, httpResponseStatusHandler receive nothing while httpStatusHandler and handleComplete receive status code 0 and null responseUrl. Does anyone experience the same thing?  I think it may be a bug of Air28 api.