From 0de817eec77cf5e7b7a404783d126672180bb45e Mon Sep 17 00:00:00 2001
From: Jean-Baptiste <bleme@pm.me>
Date: Tue, 19 Feb 2019 11:20:49 +0100
Subject: [PATCH] update: add "Location" header on "201 Created response"

---
 djangoldp/views.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/djangoldp/views.py b/djangoldp/views.py
index 0aac9e24..f4b2fb59 100644
--- a/djangoldp/views.py
+++ b/djangoldp/views.py
@@ -138,6 +138,9 @@ class LDPViewSet(LDPViewSetGenerator):
         response["Access-Control-Allow-Headers"] = "Content-Type, if-match"
         response["Access-Control-Allow-Credentials"] = 'true'
         response["Accept-Post"] = "application/ld+json"
+        if response.status_code == 201 and '@id' in response.data:
+            response["Location"] = response.data['@id']
+        response["Accept-Post"] = "application/ld+json"
         return response
 
     def update(self, request, *args, **kwargs):
-- 
GitLab