Add an = at the end of the content_type method
Shall made use of this functionality more confortable, even if it's not a real attribute of this class.
This commit is contained in:
parent
5c45e1e20b
commit
8a75f9462d
|
@ -40,7 +40,7 @@ module Zero
|
|||
# Set content length, if not already set
|
||||
content_length unless header.has_key? 'Content-Length'
|
||||
# Set content type, if not already set
|
||||
content_type 'text/html' unless header.has_key? 'Content-Type'
|
||||
self.content_type = 'text/html' unless header.has_key? 'Content-Type'
|
||||
end
|
||||
|
||||
[status, header, body]
|
||||
|
@ -56,7 +56,7 @@ module Zero
|
|||
# Sets the content type to the given value
|
||||
# Also creates it, if it does not exists
|
||||
#
|
||||
def content_type(value)
|
||||
def content_type=(value)
|
||||
self.header['Content-Type'] = value
|
||||
end
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ describe Zero::Response do
|
|||
|
||||
it "removes Content-Type, Content-Length and body on status code 204" do
|
||||
subject.body.push '"foobar"'
|
||||
subject.content_type 'application/json'
|
||||
subject.content_type = 'application/json'
|
||||
subject.header['Content-Length'] = 8
|
||||
|
||||
subject.status = 204
|
||||
|
@ -59,7 +59,7 @@ describe Zero::Response do
|
|||
|
||||
it "removes Content-Type, Content-Length and body on status code 304" do
|
||||
subject.body.push '"foobar"'
|
||||
subject.content_type 'application/json'
|
||||
subject.content_type = 'application/json'
|
||||
subject.header['Content-Length'] = 8
|
||||
|
||||
subject.status = 304
|
||||
|
@ -119,7 +119,7 @@ describe Zero::Response do
|
|||
|
||||
describe '#content_type' do
|
||||
it "sets the Content-Type to the given value" do
|
||||
subject.content_type 'application/json'
|
||||
subject.content_type = 'application/json'
|
||||
|
||||
subject.header['Content-Type'].should eq('application/json')
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue