File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 1- version : ' 3'
2-
31services :
42 elasticsearch7 :
53 image : docker.elastic.co/elasticsearch/elasticsearch:7.10.1
Original file line number Diff line number Diff line change 1818from dotenv import load_dotenv
1919from elasticsearch import Elasticsearch , RequestsHttpConnection
2020from requests_aws4auth import AWS4Auth
21+ from corsheaders .defaults import default_headers
2122from sentry_sdk .integrations .django import DjangoIntegration
2223
2324sentry_sdk .init (dsn = os .environ .get ('SENTRY_DSN' , None ),
144145USE_TZ = True
145146
146147CORS_ORIGIN_ALLOW_ALL = True
148+ CORS_ALLOW_HEADERS = list (default_headers ) + ['Client-Id' ]
147149
148150# Static files (CSS, JavaScript, Images)
149151# https://docs.djangoproject.com/en/2.2/howto/static-files/
Original file line number Diff line number Diff line change 1+ from django .test import TestCase
2+
3+
4+ class CORSClientIdTestCase (TestCase ):
5+ """Test that CORS preflight allows the Client-Id header."""
6+
7+ def test_preflight_allows_client_id_header (self ):
8+ response = self .client .options (
9+ '/v2/organizations/02feahw73' ,
10+ HTTP_ORIGIN = 'http://localhost:5173' ,
11+ HTTP_ACCESS_CONTROL_REQUEST_METHOD = 'GET' ,
12+ HTTP_ACCESS_CONTROL_REQUEST_HEADERS = 'Client-Id' ,
13+ )
14+ self .assertIn (response .status_code , (200 , 204 ))
15+ allow_headers = response .get ('Access-Control-Allow-Headers' )
16+ self .assertIsNotNone (allow_headers )
17+ allowed = [h .strip ().lower () for h in allow_headers .split (',' )]
18+ self .assertIn ('client-id' , allowed )
You can’t perform that action at this time.
0 commit comments