ontehfritz / api.mtgdb.info

Project closing first of August 2015
http://www.mtgdb.info/
MIT License
36 stars 8 forks source link

Server 500 thrown with trailing comma on field filter #61

Closed ontehfritz closed 10 years ago

ontehfritz commented 10 years ago

As per "alotau" on jabbR:

A trailing comma on a call to http://api.mtgdb.info/cards/[int,int,int,int,...] is not a problem, but... 4:54:32 PM A trailing comma on http://api.mtgdb.info/cards/?fields=id,name,cardsetid causes a server 500 error. 4:55:06 PM that previous url should have said http://api.mtgdb.info/cards/?fields=id,name,card, 7:37:59 PM perhaps there should be some sort of query parsing and some result returned that indicates a bad query? might save server load and might be helpful to clients

alotau commented 10 years ago

Hi! I'm alotau on GitHub too! Just a clarification on my clarification above: the URL should have said http://api.mtgdb.info/cards/?fields=id,name,cardsetid,

The whole point, which I think you captured well, is that a trailing comma on a field filter query breaks things.

To add to this, any bad field will throw the Server 500 error after some delay.

ontehfritz commented 10 years ago

Hey! Yes, I mentioned in JabbR that I will put a check in. If the field is invalid, it will throw an exception stating which field is invalid. This will happen before fetching the records, so there will be no wait time for the exception.