Skip to content
Snippets Groups Projects
Commit 241daf9f authored by Hans Trompert's avatar Hans Trompert
Browse files

an http request should return bytes

This solves the '500 - Request did not return bytes', that is now returned
instaed of a 304 Not Modified, while trying to fetch a discovery or topology
file that is older than the If-Modified-Since header.
parent 69d04b01
No related branches found
No related tags found
No related merge requests found
...@@ -46,7 +46,7 @@ class ModifiableResource(resource.Resource): ...@@ -46,7 +46,7 @@ class ModifiableResource(resource.Resource):
if self.representation is None: if self.representation is None:
# we haven't been given a representation yet # we haven't been given a representation yet
request.setResponseCode(500) request.setResponseCode(500)
return 'Resource has not yet been created/updated.' return b'Resource has not yet been created/updated.'
# check for if-modified-since header, and send 304 back if it is not been modified # check for if-modified-since header, and send 304 back if it is not been modified
msd_header = request.getHeader(IF_MODIFIED_SINCE) msd_header = request.getHeader(IF_MODIFIED_SINCE)
...@@ -55,7 +55,7 @@ class ModifiableResource(resource.Resource): ...@@ -55,7 +55,7 @@ class ModifiableResource(resource.Resource):
msd = datetime.datetime.strptime(msd_header, RFC850_FORMAT) msd = datetime.datetime.strptime(msd_header, RFC850_FORMAT)
if msd >= self.last_update_time: if msd >= self.last_update_time:
request.setResponseCode(304) request.setResponseCode(304)
return '' return b''
except ValueError: except ValueError:
pass # error parsing timestamp pass # error parsing timestamp
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment