Warm tip: This article is reproduced from serverfault.com, please click

Angular REST requests adds characters which breaks request

发布于 2020-11-30 11:16:18

I have an issue which did'nt happen before. When setting up a URL Angular seems to add a lot of characters to the URL thus breaking the URL.

The URL request is combined using interpolation:

const url = `${this.restUrl}​​​​​​​professionals/${userId}​​​​​​​/skills`;

When loggin the line before sending it, it looks as follows:

https://localhost:5001/​​​​​​​professionals/693450e6-1621-496a-b80f-eb6572867842​​​​​​​/skills

But when the request is made the URL is:

https://localhost:5001/%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8Bprofessionals/693450e6-1621-496a-b80f-eb6572867842%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B/skills

How can I make sure that the URL is not changed by Angular

Questioner
PieterSchool
Viewed
0
Abdelmlak Dhif 2020-11-30 20:32:55

like codebrane said its copy/paste problem.

i did copy and test the url and it get encoded the same way as you

i rewrote it and tested it , now it works fine i suggest you rewrite the parts you did copy/paste and retry !