18F / atf-eregs

Container and styles for an ATF eRegs instance
https://regulations.atf.gov/
Other
9 stars 20 forks source link

Empty Search Query triggers 400 #374

Closed cmc333333 closed 8 years ago

cmc333333 commented 8 years ago

This is then interpreted by the JS as an error. Probably want to 200 and display a warning, instead. [18/Feb/2016 12:00:27] "GET /partial/search/555?q=&version=2015-25190 HTTP/1.1" 400 24

jmcarp commented 8 years ago

@cmc333333 what do you think about skipping the request entirely when the query is empty, and showing a warning? That way we could avoid sending a request when we know the results will be empty.

cmc333333 commented 8 years ago

That'd definitely be an improvement. I think it still makes sense to clean up the the search results page too (i.e. give it a 200 with a warning), for non-JS folks.

jmcarp commented 8 years ago

One more question--on the backend, prefer to make the change in -core, where the 400 is originally raised, or to catch it in -site, where we make a request to /api/search?

cmc333333 commented 8 years ago

I'd lean towards keeping the 400 api side (it feels more semantically accurate). What do you think?

jmcarp commented 8 years ago

Agree, an empty query is a user error in the api. Just wanted to check before potentially going down the wrong path!