javascript - Sending multi dimensional query parameters via RequestOptionsArgs -
i need send http request query strings resembling following:
https://website.com/logs?filters[types][]=exception&filters[types][]=log in attempt this, i've written following code:
getlogs(filters: any): observable<log[]> { const opts: requestoptionsargs = { params: filters }; return this.http.get('https://website.com/logs', opts) .map((res: response) => { return entitybuilder.buildmany<log>(log, res.json().data); }) .catch((error: any) => observable.throw(error)); } the filters object i'm passing in getlogs() has following structure:
as can see, types property array of strings. when sending request however, angular producing url:
https://website.com/logs?types=log&types=exception i'm not sure kind of object structure filters object needs in order produce query strings need.
my other option of course use string building build query strings manually, i'd avoid if @ possible.

Comments
Post a Comment