I am trying to use bulk update from drf-extensions. To make it work, there is a safeguard requiring the header "X-BULK-OPERATION": 'true'. I can get the application working using curl or my angular app, but in my tests I am trying to use rest_framework.test.APIClient
to send the partial_update request, but every time I get a 400 response, and when debugging the request, I am getting
ipdb> response.data
{'detail': "Header 'X-BULK-OPERATION' should be provided for bulk operation."}
This is the request I am trying to use in my test
response = self.client.patch(
'/api/v1/db_items/?active=True',
json.dumps(data),
content_type='application/json',
**{X-BULK-OPERATION: 'true'}
)
Is there a way to set headers on an APIClient request?
I've even tried changing the header name and setting it in credentials with
self.client.credentials(HTTP_BULK_OPERATION='true')
but I get the same error every single time