Skip to content

Commit 43b321b

Browse files
committed
send text/plain as content-type instead of an empty string
1 parent edde6c0 commit 43b321b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/grape/api.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def add_head_not_allowed_methods
492492
not_allowed_methods = %w(GET PUT POST DELETE PATCH HEAD) - methods
493493
not_allowed_methods << "OPTIONS" if self.class.settings[:do_not_route_options]
494494
not_allowed_methods.each do |bad_method|
495-
@route_set.add_route( proc { [405, { 'Allow' => allow_header, 'Content-Type' => '' }, []]}, {
495+
@route_set.add_route( proc { [405, { 'Allow' => allow_header, 'Content-Type' => 'text/plain' }, []]}, {
496496
:path_info => path_info,
497497
:request_method => bad_method
498498
})

spec/grape/api_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def subject.enable_root_route!
403403
"example"
404404
end
405405
put '/example'
406-
last_response.headers['Content-Type'].should eql ''
406+
last_response.headers['Content-Type'].should eql 'text/plain'
407407
end
408408

409409
it 'adds an OPTIONS route that returns a 204 and an Allow header' do

0 commit comments

Comments
 (0)