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

mmd notifications at github.com
Wed Jan 22 17:52:07 UTC 2020


mmd-osm commented on this pull request.



> +        if mime.symbol == :xml
+          request.format = "xml"
+          break
+        end
+
+        if mime.symbol == :json
+          request.format = "json"
+          break
+        end
+
+        # Any format, not explicitly requesting XML or JSON -> assume XML as default
+        if mime == "*/*"
+          request.format = "xml"
+          break
+        end
+      end

In both cases the response was generated by cgimap, so yes, Rails port and cgimap behaved differently for many years here.

In general, Accept header support in Rails is quite a delicate topic. There's a number of issues out there, like adding `*/*` would break multi format output, or as in your example, requesting text/plain would happily return XML.

It was the main reason for another round of Accept header parsing in _set_default_request_format_, rather than relying on the framework to do the right thing.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2485#discussion_r369710862
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20200122/ac39ea91/attachment.htm>


More information about the rails-dev mailing list