Nativescript: Http Module Error: unsupported URL

Created on 1 Apr 2016  Â·  8Comments  Â·  Source: NativeScript/NativeScript

Did you verify this is a real problem by searching

Yup

Tell us about the problem

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

var url = "https://www.outbreakhelp.ca/RestApi/app/resources?format=json&locale=fr-CA&type=actualit%C3%A9s";

http.getJSON(url).then(function (data) {
   //whatevs
 }, function (e) {
  //We crash Error: unsupported URL
});

So this works just fine in the browser with jQuery\KendoUI, the {N} module gives a big NOOOPE

Which platform(s) does your issue occur on?

iOS (unsure of android)

Please provide the following version numbers that your issue occurs with:

  • CLI: 1.7.1
  • Cross-platform modules:1.7.0

    Please tell us how to recreate the issue in as much detail as possible.

Run the above code

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

See above

All 8 comments

Gonna close, suppose the fix is to encode the problem url parts!

I'm having the same issue, my URL is 97 characters long. I don't understand why the issue was closed.

@sitefinitysteve Hey mate, I'm experiencing the same issue.

Can you please advise as to how you encoded the problem parts?

@sm1ddy Just give'r a

var myText = "23w%"#%$"#$^"#$^";
encodeURIComponent(myText)

@sitefinitysteve

Thanks mate, I've given it a go but still getting the same error. Basically I am trying to use this URL (which works fine on Android):

"https://maps.googleapis.com/maps/api/geocode/json?latlng=" + pageModel.latitude + "," + pageModel.longitude + "&components=country:AU|administrative_area:TAS&key=MY_API_KEY";

From my testing I've narrowed down that this part breaks it:
"components=country:AU|administrative_area:TAS"

Even more specifically it seems to be the "|" character. Will make another post if I work out how to fix this.

Thats the chunk i would encode... You didn't encode the entire thing, just
that right?

On Dec 5, 2017 9:25 PM, "Anthony Smith" notifications@github.com wrote:

@sitefinitysteve https://github.com/sitefinitysteve

Thanks mate, I've given it a go but still getting the same error. Basically
I am trying to use this URL (which works fine on Android):

"https://maps.googleapis.com/maps/api/geocode/json?latlng=" +
pageModel.latitude + "," + pageModel.longitude + "&components=country:AU|
administrative_area:TAS&key=MY_API_KEY";

From my testing I've narrowed down that this part breaks it:
"components=country:AU|administrative_area:TAS"

Even more specifically it seems to be the "|" character. Will make another
post if I work out how to fix this.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/NativeScript/NativeScript/issues/1879#issuecomment-349510071,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABeI6EGRvDFEoI0rh8QjWjo10vpbxShyks5s9fsJgaJpZM4H9PZb
.

Literally just ran my code only encoding "components=country:AU|administrative_area:TAS".

Seems to be working, maybe when I ran it before my changes didn't update... or I didn't save.

Thanks for your help :)

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yclau picture yclau  Â·  3Comments

OscarLopezArnaiz picture OscarLopezArnaiz  Â·  3Comments

pocesar picture pocesar  Â·  3Comments

rLoka picture rLoka  Â·  3Comments

tsonevn picture tsonevn  Â·  3Comments