Skip to content

Commit

Permalink
Corrected the default_content_type parameter to contrib.http.Request …
Browse files Browse the repository at this point in the history
…to content_type
  • Loading branch information
Erik Allik committed Sep 26, 2013
1 parent 7c6b2a7 commit 1daa29b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spinoff/contrib/http/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@ def response_stream(ch):


class Request(BaseRequest):
def __init__(self, ch, env, start_response, default_content_type):
def __init__(self, ch, env, start_response, content_type):
self.ch = ch
self.env = env
self._response_started = False
self._start_response = start_response
self.default_content_type = default_content_type
self.content_type = content_type
self.closed = False
BaseRequest.__init__(self, env)

def set_status(self, status):
self.start_response(status, [('Content-Type', self.default_content_type)])
self.start_response(status, [('Content-Type', self.content_type)])

def start_response(self, *args):
self._response_started = True
Expand All @@ -116,15 +116,15 @@ def start_response(self, *args):

def write(self, data):
if not self._response_started:
self._start_response('200 OK', [('Content-Type', self.default_content_type)])
self._start_response('200 OK', [('Content-Type', self.content_type)])
self.ch.put(data)

def writeln(self, data):
self.write(data + b'\n')

def close(self):
if not self._response_started:
self._start_response('200 OK', [('Content-Type', self.default_content_type)])
self._start_response('200 OK', [('Content-Type', self.content_type)])
self.closed = True
self.ch.put(_BREAK)

Expand Down

0 comments on commit 1daa29b

Please sign in to comment.