302 redirect loses JSON .format


(znation) #1

I am attempting to use the REST API to programatically retrieve JSON replies to posts. The post titles are predictable, so I am making calls like:

GET http://servername/t/post-title-foo.json

However, this 302 redirects to “http://servername/t/post-title-foo/:id” (where :id is the unique ID of the post, which I don’t know how to predict).

Here’s a repro (note that it 302 redirects to a non-JSON URL):
http://try.discourse.org/t/this-site-is-a-sandbox-it-is-reset-every-day.json

I think this is a bug, since I would expect the redirect to preserve format (if my original request URL had .json on the end, I think it should redirect to a .json URL). Should I open a bug on GitHub issues?


(Jeff Atwood) #2

No PLEASE do not duplicate effort, here is correct.


(Sam Saffron) #3

This is now fixed:

https://github.com/discourse/discourse/commit/6dbd6f7428c10201b8511ecb5b8ca8460d4dc444


(Sam Saffron) #4