Skip to content

Commit

Permalink
Merge pull request #37 from uw-it-aca/feature/test-no-config
Browse files Browse the repository at this point in the history
add status for failure responses
  • Loading branch information
jlaney authored Oct 16, 2017
2 parents d2f21c6 + 6459e26 commit 851d3a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions blti/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def get(self, request, *args, **kwargs):
params = self.validate(request)
except BLTIException as err:
self.template_name = 'blti/401.html'
return self.render_to_response({})
return self.render_to_response({}, status=401)

context = self.get_context_data(
request=request, blti_params=params, **kwargs)
Expand Down Expand Up @@ -55,7 +55,7 @@ def post(self, request, *args, **kwargs):
self.set_session(request, **params)
except BLTIException as err:
self.template_name = 'blti/error.html'
return self.render_to_response({'error': err})
return self.render_to_response({'error': err}, status=400)

context = self.get_context_data(
request=request, blti_params=params, **kwargs)
Expand All @@ -67,11 +67,11 @@ def post(self, request, *args, **kwargs):
def validate(self, request):
params = {}
body = request.read()
if body and len(body):
try:
params = dict((k, v) for k, v in [tuple(
map(unquote_plus, kv.split('='))
) for kv in body.split('&')])
else:
except Exception:
raise BLTIException('Missing or malformed parameter or value')

blti_params = BLTIOauth().validate(request, params=params)
Expand Down

0 comments on commit 851d3a7

Please sign in to comment.