Issue 16262

http language header not respected for vernacular names

16262
Reporter: mdoering
Assignee: mblissett
Type: Bug
Summary: http language header not respected for vernacular names
Priority: Major
Resolution: Fixed
Status: Closed
Created: 2014-08-21 10:41:14.479
Updated: 2016-02-10 14:35:39.696
Resolved: 2016-02-10 14:25:26.726
TimeEstimate: 0
TimeSpent: 1200
        
Description: The language of the single vernacular name of a name usage returned by the species API should be determined by either a language GET parameter or the standard http Accept-Language header. If no language was requested the vernacular name should not be returned by the API.

Testing the different ways of submitting the language parameter via curl reveals the http header is not respected:

-----

curl http://api.gbif.org/v1/species/5231190 | jq '.vernacularName'
""

curl http://api.gbif.org/v1/species/5231190?language=de | jq '.vernacularName'
"Haussperling"

curl http://api.gbif.org/v1/species/5231190?language=en | jq '.vernacularName'
"House Sparrow"

curl -H "Accept-Language: de" http://api.gbif.org/v1/species/5231190 | jq '.vernacularName'
""

curl -H "Accept-Language: en" http://api.gbif.org/v1/species/5231190?language=de | jq '.vernacularName'
"Haussperling"
]]>
    


Author: mblissett
Created: 2016-02-10 14:25:27.231
Updated: 2016-02-10 14:25:27.231
        
The demonstrative commands actually run into the problem with Varnish caching, see POR-2969.

But the problem with an English name being returned when we didn't have a name in the requested language was true, and now corrected.