Skip to content

Commit

Permalink
Merge pull request #3185 from sabzo/feature/3132
Browse files Browse the repository at this point in the history
if application content is not json, return 400
  • Loading branch information
sabzo authored Oct 13, 2022
2 parents 400b283 + 817d927 commit 20a824d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions perma_web/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,9 @@ def post(self, request, format=None):
# mark batch with user
if not request.user.is_authenticated:
raise PermissionDenied()
if request.content_type != 'application/json':
content = {'detail': 'content-type must be aplication/json'}
return Response(content, status=status.HTTP_400_BAD_REQUEST)
request.data['created_by'] = request.user.pk

# save batch
Expand Down

0 comments on commit 20a824d

Please sign in to comment.