From c5d2a0e7ea5cb203cfe0f7e7d4d6a9b7c0171803 Mon Sep 17 00:00:00 2001
From: Calum Mackervoy <c.mackervoy@gmail.com>
Date: Thu, 13 Oct 2022 21:46:43 +0200
Subject: [PATCH] update (serializer): replace Accept-Shape header with
 Accept-Model-Fields

---
 djangoldp/serializers.py             | 2 +-
 djangoldp/tests/tests_ldp_viewset.py | 2 +-
 docs/create_model.md                 | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/djangoldp/serializers.py b/djangoldp/serializers.py
index 9920aef2..5f2df186 100644
--- a/djangoldp/serializers.py
+++ b/djangoldp/serializers.py
@@ -417,7 +417,7 @@ class LDPSerializer(HyperlinkedModelSerializer):
 
         # we allow the request object to specify a subset of fields which should be serialized
         model_fields = self.get_fields()
-        req_header_accept_shape = self.context['request'].META.get('HTTP_ACCEPT_SHAPE') if 'request' in self.context else None
+        req_header_accept_shape = self.context['request'].META.get('HTTP_ACCEPT_MODEL_FIELDS') if 'request' in self.context else None
         allowed_fields = list(set(req_header_accept_shape).intersection(model_fields.keys())) if req_header_accept_shape is not None else model_fields.keys()
 
         for key, value in model_fields.items():
diff --git a/djangoldp/tests/tests_ldp_viewset.py b/djangoldp/tests/tests_ldp_viewset.py
index 4e81e0cb..368f9880 100644
--- a/djangoldp/tests/tests_ldp_viewset.py
+++ b/djangoldp/tests/tests_ldp_viewset.py
@@ -74,7 +74,7 @@ class LDPViewSet(APITestCase):
         # request id and name only
         fields_shape = ["@id", "name"]
 
-        response = self.client.get('/circles/', HTTP_ACCEPT_SHAPE=fields_shape)
+        response = self.client.get('/circles/', HTTP_ACCEPT_MODEL_FIELDS=fields_shape)
         self.assertEqual(response.status_code, status.HTTP_200_OK)
         response_data_keys = response.data['ldp:contains'][0].keys()
         self.assertEqual(len(response_data_keys), 4)
diff --git a/docs/create_model.md b/docs/create_model.md
index 2dfe42d8..2d71f365 100644
--- a/docs/create_model.md
+++ b/docs/create_model.md
@@ -213,7 +213,7 @@ In the following example, besides the urls `/members/` and `/members/<pk>/`, two
 
 ### Improving Performance
 
-On certain endpoints, you may find that you only need a subset of fields on a model, and serializing them all is expensive (e.g. if I only need the `name` and `id` of each group chat, then why serialize all of their members?). To optimise the fields serialized, you can pass a custom header in the request, `Accept-Shape`, with a `list` value of desired fields e.g. `['@id', 'name']`
+On certain endpoints, you may find that you only need a subset of fields on a model, and serializing them all is expensive (e.g. if I only need the `name` and `id` of each group chat, then why serialize all of their members?). To optimise the fields serialized, you can pass a custom header in the request, `Accept-Model-Fields`, with a `list` value of desired fields e.g. `['@id', 'name']`
 
 ## Filter Backends
 
-- 
GitLab