Merge pull request #2439 from ryanpetrello/copy-over-here

Add a Location header to HTTP 201 for POST to copy endpoints
This commit is contained in:
Ryan Petrello 2018-07-09 09:28:51 -04:00 committed by GitHub
commit e886311d41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -980,4 +980,5 @@ class CopyAPIView(GenericAPIView):
permission_check_func=permission_check_func
)
serializer = self._get_copy_return_serializer(new_obj)
return Response(serializer.data, status=status.HTTP_201_CREATED)
headers = {'Location': new_obj.get_absolute_url(request=request)}
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)