Skip to content

Commit

Permalink
Merge pull request #5210 from dimagi/500-to-Badrequest
Browse files Browse the repository at this point in the history
500 to bad request on Submissions to unknown domain
  • Loading branch information
millerdev committed Jan 6, 2015
2 parents dc66ff7 + 6804581 commit 652364a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions corehq/apps/receiverwrapper/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from couchdbkit import ResourceNotFound
from couchdbkit.ext.django.loading import get_db
from django.http import (
HttpResponseBadRequest,
Expand Down Expand Up @@ -62,10 +63,15 @@ def _process_form(request, domain, app_id, user_id, authenticated,
@csrf_exempt
@require_POST
def post(request, domain, app_id=None):
if domain_requires_auth(domain):
# "redirect" to the secure version
# an actual redirect doesn't work because it becomes a GET
return secure_post(request, domain, app_id)
try:
if domain_requires_auth(domain):
# "redirect" to the secure version
# an actual redirect doesn't work because it becomes a GET
return secure_post(request, domain, app_id)
except ResourceNotFound:
return HttpResponseBadRequest(
'No domain with name %s' % domain
)
return _process_form(
request=request,
domain=domain,
Expand Down

0 comments on commit 652364a

Please sign in to comment.