I'm currently using an API with functionnal tests. So I know that I'll have a good response with the url bellow :
/api/v1/investisseurs?vehicule%5B0%5D=4
Equivalent url decoded
/api/v1/investisseurs?vehicule[0]=4
Using Angular to emit my call with HttpParams like follow
getInvestors(params: HttpParams): Promise<MelodiiaCollectionResponse> {
console.log(params);
return <Promise<MelodiiaCollectionResponse>>this.http.get(environment.httpdBackHost + '/investisseurs', {
params: params,
}).toPromise();
This result with the following request in my browser
/api/v1/investisseurs?vehicule%5B%5D=%5B%222%22%5D&page=1&max_per_page=15
Equivalent url decoded
/api/v1/investisseurs?vehicule[]=["2"]&page=1&max_per_page=15
Question, how it is possible to have the same query parameter encoding as the php method http_build_query within Angular 7?
I would like avoid reimplement the wheel myself :)
Thank in advance for your help