<p><b>@gravitystorm</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/2485#discussion_r369693899">app/controllers/api_controller.rb</a>:</p>
<pre style='color:#555'>> @@ -3,6 +3,52 @@ class ApiController < ApplicationController
 
   private
 
+  ##
+  # Set default request format to xml unless a client requests a specific format,
+  # which can be done via (a) URL suffix and/or (b) HTTP Accept header, where
+  # the URL suffix always takes precedence over the Accept header.
+  def set_default_request_format
</pre>
<blockquote>
<p>It would be better to return 406 Not Acceptable instead of HTTP 500. Somehow the Rails framework doesn't handle this properly. but unfortunately that's outside of anything I control.</p>
</blockquote>
<p>I've investigated this, and I believe it's because we wrap all api calls in our own <code>api_call_handle_error</code>. You might be able to solve this by adding</p>
<pre><code>rescue ActionController::UnknownFormat
   head :not_acceptable
</code></pre>
<p>to the top of the list of handled exceptions at <a href="https://github.com/openstreetmap/openstreetmap-website/blob/f7f73322b3abae8648d6462914eea032a93263fd/app/controllers/application_controller.rb#L186-L204">https://github.com/openstreetmap/openstreetmap-website/blob/f7f73322b3abae8648d6462914eea032a93263fd/app/controllers/application_controller.rb#L186-L204</a></p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/2485?email_source=notifications&email_token=AAK2OLNLB4LH7UR7BPJV2NTQ7B5VXA5CNFSM4KAKS5KKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCSVS2RA#discussion_r369693899">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLMMOSXDFGENLKFDBI3Q7B5VXANCNFSM4KAKS5KA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAK2OLPZZPK5IBZ2GNQF7WDQ7B5VXA5CNFSM4KAKS5KKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCSVS2RA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/2485?email_source=notifications\u0026email_token=AAK2OLNLB4LH7UR7BPJV2NTQ7B5VXA5CNFSM4KAKS5KKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCSVS2RA#discussion_r369693899",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/2485?email_source=notifications\u0026email_token=AAK2OLNLB4LH7UR7BPJV2NTQ7B5VXA5CNFSM4KAKS5KKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCSVS2RA#discussion_r369693899",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>