Bug with HTTPRequest?

  1. 4 years ago

    ingurgite

    5 Sep 2019 User since 2018
    Edited 4 years ago by ingurgite

    Hi,

    I am trying to fetch an image from the Web: https://s3.amazonaws.com/marquee-test-akiaisur2rgicbmpehea/2cGnbrJxQCyeguL6vvRo_Engine%20to%20Increase%20Product-Market%20Fit.jpg

    With HTTPRequest, I get an error from the Runtime (see attached).

    I don't see:
    1) Why there is an error as the URL is correct
    2) Why the error is generated at the runtime level; even if the URL was ill formed, it should trigger the onError() callback

    My code:

    var _header = "https://s3.amazonaws.com/marquee-test-akiaisur2rgicbmpehea/2cGnbrJxQCyeguL6vvRo_Engine%20to%20Increase%20Product-Market%20Fit.jpg"
    var _request = HTTPRequest(_header)
    
    _request.responseSerializerType = HTTPResponseSerializer.Data
    _request.timeoutInterval = 120
    _request.redirectMode = HTTPRedirectMode.Allow
    
    func _onSuccess(request, value)
    {
    	Console.write("OK")
    }
    func _onError(request, error)
    {
    	Console.write("ERROR")
    }
    _request.send(_onSuccess, _onError)

    Thanks a lot.

  2. marco

    5 Sep 2019 Administrator User since 2016

    Hi @ingurgite you are right, there is a bug on our side (already fixed so you can expect a new release pretty soon). As a workaround you should use an URL without percent encoding (so without %20 in your case).

or Sign Up to reply!