Commit 088497a1 by Greg Price

Merge pull request #70 from edx/gprice/content-type-json

Fix Content-Type header
parents d3ba8bfe 1343ca1e
......@@ -5,6 +5,8 @@ These are notable changes in cs_comments_service. This is a rolling list of cha
in roughly chronological order, most recent first. Add your entries at or near
the top. Include a label indicating the component affected.
**app.rb:** Return the correct Content-Type, application/json.
**api:** Add the ability to filter by commentable id to more endpoints
(in particular, /threads).
......
......@@ -66,6 +66,10 @@ if RACK_ENV.to_s != "test" # disable api_key auth in test environment
end
end
before do
content_type "application/json"
end
if ENV["ENABLE_IDMAP_LOGGING"]
after do
......
......@@ -4,6 +4,12 @@ describe "app" do
describe "comments" do
before(:each) { init_without_subscriptions }
describe "GET /api/v1/comments/:comment_id" do
it "returns JSON" do
comment = Comment.first
get "/api/v1/comments/#{comment.id}"
last_response.should be_ok
last_response.content_type.should == "application/json;charset=utf-8"
end
it "retrieve information of a single comment" do
comment = Comment.first
get "/api/v1/comments/#{comment.id}"
......
......@@ -308,6 +308,13 @@ describe "app" do
before(:each) { init_without_subscriptions }
it "returns JSON" do
thread = CommentThread.first
get "/api/v1/threads/#{thread.id}"
last_response.should be_ok
last_response.content_type.should == "application/json;charset=utf-8"
end
it "get information of a single comment thread" do
thread = CommentThread.first
get "/api/v1/threads/#{thread.id}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment