[openstreetmap/openstreetmap-website] JSON output nodes, ways, relations, map (#2485)

mmd notifications at github.com
Fri Feb 28 10:02:41 UTC 2020

> So have you completely ignored the rails processing and done your own from scratch?

I wouldn't call it doing it all from scratch. I'm reusing the same MIME parsing logic the framework also uses and set a default format in case of XML, JSON or `*/*` for selected methods only.

> Can you explain more about the JOSM issue? Does it only affect old versions or does it still affect the current version? Has it been reported?

Sure. What they are currently sending is the following:

text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2

There are a number of issues here:
- `*` is not a valid mime type, the spec requires `<MIME_type>/<MIME_subtype>`
- The additional space after the semicolon is not permitted
- The number format in q=.2 is invalid, is should be q=0.2

I haven't reported those yet. Given that old versions will linger around for a longish time, we'd need to deal with this in any case.

>  but avoiding them is not a good reason to use a suboptimal solution to something 

I think this would only affect the initial part of the set_default_request_format method, where neither an Accept header, not an url suffix were set (as in the case of unit tests only).

      accept_header = request.headers["HTTP_ACCEPT"]
      if accept_header.nil?
        # e.g. unit tests don't set an Accept: header by default, force XML in this case
        request.format = "xml"

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20200228/1ae14147/attachment.htm>

More information about the rails-dev mailing list