Closed
Bug 555251
Opened 15 years ago
Closed 15 years ago
[k] format=json searches that don't actually search should return empty result set
Categories
(support.mozilla.org :: Search, defect, P4)
support.mozilla.org
Search
Tracking
(Not tracked)
VERIFIED
FIXED
2.0
People
(Reporter: jsocol, Assigned: paulc)
Details
Probably. Executing a search via JSON and finding a blob of HTML is probably confusing. We should at least send a 'no-results' style object, or possibly an error notification (if there is an error) and consider what response code we use. (404? How would that interact with Zeus?)
Reporter | ||
Updated•15 years ago
|
Priority: -- → P4
Assignee | ||
Comment 1•15 years ago
|
||
+1 for 404, that makes it easy to check in e.g. jQuery, e.g.
function error(XMLHttpResponse) {
if (XMLHttpResponse).status == 404) {
// show XMLHttpResponse.message
}
}
Perhaps Shyam can tell us if that's a good idea?
Comment 2•15 years ago
|
||
Paul/James, a little more context? :) I don't completely understand what we're trying to do?
Reporter | ||
Comment 3•15 years ago
|
||
Shyam, my only question is if Zeus has any strange rules about caching 404s?
Comment 4•15 years ago
|
||
Unsure, Jeremy?
Comment 5•15 years ago
|
||
I believe zeus does cache 404s by default, but we can tell it not to cache them.
Assignee | ||
Updated•15 years ago
|
Assignee: nobody → paulc
Assignee | ||
Comment 6•15 years ago
|
||
Thanks Jeremy.
Pushed to development branch:
http://github.com/pcraciunoiu/kitsune/commit/6452eadb503a44d6e2679581b359b1f71aed82ed
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 7•15 years ago
|
||
For QA, basically:
* adding format=json in the URL should return JSON results.
* if no (valid!) callback is provided, Content-Type=application/json
* otherwise (no callback), Content-Type=application/x-javascript
It's easy to notice the Content-Type in Firefox, as it tries to download JSON but simply displays JavaScript.
Let me know if you have any other questions.
Comment 8•15 years ago
|
||
Here's what I tested, for comment 0:
* http://support-stage-new.mozilla.com/en-US/search?q=&format=json&callback=arr[1] yields {"error": "Invalid search data."}, served as application/x-javascript
* http://support-stage-new.mozilla.com/en-US/search?q=jksljfksljflsd&format=json&callback=arr[1] yields arr[1]({"query": "jksljfksljflsd", "message": "No pages matched the search criteria", "total": 0, "results": []}); also served as application/x-javascript
* http://support-stage-new.mozilla.com/en-US/search?q=sjkfljslf8ssf8d908sfd890s890af890sd&format=json yields the JS file as application/json
Verified?
Updated•15 years ago
|
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•