Skip to content
Snippets Groups Projects
Commit 1b6e6634 authored by Jeremy Bowman's avatar Jeremy Bowman Committed by Feanil Patel
Browse files

Fix edxnotes stub tests BOM-633

parent 835a84f3
No related merge requests found
......@@ -121,7 +121,7 @@ class StubEdxNotesServiceHandler(StubHttpRequestHandler):
}
if status_code < 400 and content:
headers["Content-Type"] = "application/json"
content = json.dumps(content)
content = json.dumps(content).encode('utf-8')
else:
headers["Content-Type"] = "text/html"
......@@ -131,7 +131,7 @@ class StubEdxNotesServiceHandler(StubHttpRequestHandler):
"""
Create a note, assign id, annotator_schema_version, created and updated dates.
"""
note = json.loads(self.request_content)
note = json.loads(self.request_content.decode('utf-8'))
note.update({
"id": uuid4().hex,
"annotator_schema_version": "v1.0",
......@@ -146,7 +146,7 @@ class StubEdxNotesServiceHandler(StubHttpRequestHandler):
The same as self._create, but it works a list of notes.
"""
try:
notes = json.loads(self.request_content)
notes = json.loads(self.request_content.decode('utf-8'))
except ValueError:
self.respond(400, "Bad Request")
return
......@@ -181,7 +181,7 @@ class StubEdxNotesServiceHandler(StubHttpRequestHandler):
"""
Update the note by note id.
"""
note = self.server.update_note(note_id, json.loads(self.request_content))
note = self.server.update_note(note_id, json.loads(self.request_content.decode('utf-8')))
if note:
self.respond(content=note)
else:
......
......@@ -92,7 +92,7 @@ class StubHttpRequestHandler(BaseHTTPRequestHandler, object):
Retrieve the content of the request.
"""
try:
length = int(self.headers.getheader('content-length'))
length = int(self.headers.get('content-length'))
except (TypeError, ValueError):
return ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment