sureshchahal / angular2-adal

Angular 2 wrapper for adal.js
MIT License
41 stars 50 forks source link

URL query params are double encoded. #19

Closed harry671003 closed 7 years ago

harry671003 commented 7 years ago

When passed a query string that contains special characters, eg: { , the url is being encoded twice.

let filter = {
    Field: 'Name',
    Value: 'Alex',
    Operator: 'Equals'
};

let searchParams: URLSearchParams = new URLSearchParams();
searchParams.set('filter', JSON.stringify(filter));

this.authHttp.get(
    apiUrl,
    new RequestOptions({
        headers: additionalHeaders,
        search: searchParams
    })
);

The query string is filter= {Field: 'Name', Value: 'Alex', Operator: 'Equals'}

Here { becomes %7B, before being passed to authHttp.get and inside sendRequest the % will again be encoded to %25 resulting in %257B

sureshchahal commented 7 years ago

@harry671003 Just fixed this and uploaded again. Can you please verify?

harry671003 commented 7 years ago

@sureshchahal Just verified this. This works perfectly. Thanks!