• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

URLLoader does not response http 301 status code

Explorer ,
Apr 15, 2018 Apr 15, 2018

Copy link to clipboard

Copied

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.

Views

315

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines