Skip to content

Commit

Permalink
Merge pull request #8 from csev/issue-4
Browse files Browse the repository at this point in the history
issue-4 - Add decode and fix content-length
  • Loading branch information
edcrewe committed Oct 26, 2019
2 parents fa4c7da + 61359cf commit b87b1ab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cookieless/middleware.py
Expand Up @@ -199,7 +199,7 @@ def new_url(match):
try:
response.content = self._re_links.sub(
new_url, response.content.decode()
)
).encode()
except:
pass

Expand All @@ -217,9 +217,11 @@ def new_url(match):
try:
response.content = self._re_forms.sub(
repl_form, response.content.decode()
)
).encode()
except:
pass
response['Content-Length'] = len(response.content);
return response
else:
response['Content-Length'] = len(response.content);
return response

0 comments on commit b87b1ab

Please sign in to comment.