Skip to content

Commit bed7867

Browse files
author
Jerry Cheung
committed
forgot 2 other references for changing default format to json
1 parent f745839 commit bed7867

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/grape/endpoint.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def build_middleware
276276

277277
b.use Grape::Middleware::Formatter,
278278
:format => settings[:format],
279-
:default_format => settings[:default_format] || :txt,
279+
:default_format => settings[:default_format] || :json,
280280
:content_types => settings[:content_types]
281281

282282
aggregate_setting(:middleware).each do |m|

spec/grape/api_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,12 @@ def app; subject end
320320

321321
it 'should set content type for txt format' do
322322
get '/foo'
323-
last_response.headers['Content-Type'].should eql 'text/plain'
323+
last_response.headers['Content-Type'].should eql 'application/json'
324324
end
325325

326-
it 'should set content type for json' do
327-
get '/foo.json'
328-
last_response.headers['Content-Type'].should eql 'application/json'
326+
it 'should set content type for txt' do
327+
get '/foo.txt'
328+
last_response.headers['Content-Type'].should eql 'text/plain'
329329
end
330330

331331
it 'should set content type for error' do

0 commit comments

Comments
 (0)