twitchtv / node-apicalypse

The apicalypse query language client for nodejs
MIT License
83 stars 10 forks source link

Multiple .filter() Calls Results in HTTP Code 500 #2

Closed dacioromero closed 3 years ago

dacioromero commented 5 years ago

Error When running .filter() multiple times to build a query, multiplefilter [filters]; appear in the request data. The IDGB v3 API sends a 500 code, but also valid JSON resulting in Axios to throw an error.

Research The code suggests to me the request data is invalid, but this repo's tests also suggest to me that it is valid because .filter() is called multiple times, but this might just be to make testing both arrays and strings easier.

If it is unsupported, calling .filter() and perhaps other similar methods like .fields() should add to previous calls.

Potential Solution This could be resolved by having a dictionary this.filterDict instead of this.filterArray which each method checks against and then .constructOptions() uses to generate the request data.

I'm going to start working on code tonight that should work.