Skip to content

Commit

Permalink
Merge pull request #6 from dokai/str-headers
Browse files Browse the repository at this point in the history
Ensure response headers are given as strings (not unicode)
  • Loading branch information
tilgovi committed Oct 21, 2014
2 parents 9552ec9 + 3cdca9f commit 03d9a1a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pyramid_oauthlib/__init__.py
Expand Up @@ -5,6 +5,7 @@
from oauthlib import oauth2
from oauthlib.oauth2.rfc6749.endpoints import base
from pyramid.response import Response
from pyramid.compat import bytes_

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -167,7 +168,11 @@ def getter(request):

def oauth_response(result): # pragma: no cover
headers, body, status = result
return Response(body=body, status=status, headers=headers)
return Response(body=body, status=status, headers={
bytes_(name, 'utf-8'): bytes_(value, 'utf-8')
for name, value
in headers.iteritems()
})


def register(config, server):
Expand Down

0 comments on commit 03d9a1a

Please sign in to comment.