Explorar o código

Fix Location header for PUT.

Stefano Cossu %!s(int64=7) %!d(string=hai) anos
pai
achega
7027ee3a05
Modificáronse 1 ficheiros con 7 adicións e 2 borrados
  1. 7 2
      lakesuperior/endpoints/ldp.py

+ 7 - 2
lakesuperior/endpoints/ldp.py

@@ -207,8 +207,13 @@ def put_resource(uuid):
     except TombstoneError as e:
         return _tombstone_response(e, uuid)
 
-    res_code = 201 if ret == Ldpr.RES_CREATED else 204
-    return rsrc.uri, res_code, rsp_headers
+    if ret == Ldpr.RES_CREATED:
+        rsp_code = 201
+        rsp_headers['Location'] = rsp_body = rsrc.uri
+    else:
+        rsp_code = 204
+        rsp_body = ''
+    return rsp_body, rsp_code, rsp_headers
 
 
 @ldp.route('/<path:uuid>', methods=['PATCH'], strict_slashes=False)