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:

filters object

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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -