I am running an Angular 4.x app and have a GET request to an endpoint that has querystring parameters such as the following :
https://dev.mywebsite.com/debug/me/user?__token=1000001445.k4mv42stmo1h7x1&apiversion=1&appid=3apiversion=1&appid=3
This works when I add this into postman and I can get a response back however when I run the following code in my Angular component it fails and gives the following error(s)
constructor(private http: HttpClient) { }
ngOnInit(): void {
this.http.get('https://dev.website.com/debug/me/user', {
params: { token:'1000001445.k4mv42stmo1h7x1', appid:3 }
})
.subscribe(data => {
console.log('data', data);
});
}
In the console.log in the network tab I can see this request has [object Object] under the the Headers tab in the Querystring section - why is this?
HttpParamsclass (angular.io/api/common/http/HttpParams)?getby passing inhttps://dev.mywebsite.com/debug/me/user?__token=1000001445.k4mv42stmo1h7x1&apiversion=1&appid=3apiversion=1&appid=3. without params.HttpParams | {[param: string]: string | string[];};so what you have is valid except the values should be stringsappid: '3'. This will generate a url ofhttps://dev.website.com/debug/me/user?token=1000001445.k4mv42stmo1h7x1&appId=3. From the url you posted, it looks like you are missing some fields from your params object