Responses should follow the principle of least astonishment #6108
Labels
Bug
For errors / faults / flaws / inconsistencies etc.
Major
Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
worksforme
The issue cannot be reproduced and things work as intended.
Milestone
For example, Piwik::Referers.getKeywords will normally return an array of hashes if the site has multiple keywords.
However, if the site is new and has a single keyword, won't return a hash but instead a single hash. Instead, that same hash should be returned inside an array to reduce the extra code necessary.
If a site has no keywords, the response is a single hash:
{"nb_visits" => 0}
This is not only unnecessary, but it is yet again another case that require extra code to be written.
Instead, an empty array should be the result.
The text was updated successfully, but these errors were encountered: