[openstreetmap/openstreetmap-website] Add support for json traces API (PR #5943)

Tom Hughes notifications at github.com
Tue Apr 22 17:30:08 UTC 2025


@tomhughes requested changes on this pull request.

This will definitely need some tests - basically cloning the existing XML tests and adjusting them for JSON would be a good start.

Does CONTRIBUTING.md not explain what you need to know?

> +        respond_to do |format|
+          format.xml { render :content_type => "application/xml" }
+          format.json { render :content_type => "application/json" }
+        end

I don't think you need the explicit content type here. I think this will suffice:
```suggestion
        respond_to do |format|
          format.xml
          format.json
        end
```

> @@ -7,7 +7,10 @@ class TracesController < ApiController
 
       def index
         @traces = current_user.traces.reload
-        render :content_type => "application/xml"
+        respond_to do |format|
+          format.xml { render :content_type => "application/xml" }
+          format.json { render :content_type => "application/json" }
+        end

Same goes here.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5943#pullrequestreview-2784818932
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5943/review/2784818932 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250422/892df6fa/attachment-0001.htm>


More information about the rails-dev mailing list