Skip to content

Commit 76fc1bc

Browse files
committed
fix: remove redundant Content-Type headers and standardize response content types to application/json
1 parent a82ec0a commit 76fc1bc

File tree

3 files changed

+37
-36
lines changed

3 files changed

+37
-36
lines changed

tests/test_custom_metadata_fields_ops.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def test_get_custom_metadata_fields_succeeds(self):
6262
responses.add(
6363
responses.GET,
6464
url,
65+
content_type="application/json",
6566
body="""[{
6667
"id": "62a9d5f6db485107347bb7f2",
6768
"name": "test10",
@@ -115,7 +116,7 @@ def test_get_custom_metadata_fields_succeeds(self):
115116
],
116117
"httpStatusCode": 200,
117118
"headers": {
118-
"Content-Type": "text/plain",
119+
"Content-Type": "application/json",
119120
"Accept-Encoding": "gzip, deflate",
120121
"Authorization": "Basic ZmFrZTEyMjo=",
121122
},
@@ -385,7 +386,7 @@ def test_create_custom_metadata_fields_succeeds_with_type_number(self):
385386
"""
386387
URL.API_BASE_URL = "http://test.com"
387388
url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL)
388-
headers = {"Content-Type": "application/json"}
389+
headers = {}
389390
headers.update(create_headers_for_test())
390391
responses.add(
391392
responses.POST,
@@ -458,7 +459,7 @@ def test_create_custom_metadata_fields_succeeds_with_type_textarea(self):
458459
"""
459460
URL.API_BASE_URL = "http://test.com"
460461
url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL)
461-
headers = {"Content-Type": "application/json"}
462+
headers = {}
462463
headers.update(create_headers_for_test())
463464
responses.add(
464465
responses.POST,
@@ -545,7 +546,7 @@ def test_create_custom_metadata_fields_succeeds_with_type_date(self):
545546
"""
546547
URL.API_BASE_URL = "http://test.com"
547548
url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL)
548-
headers = {"Content-Type": "application/json"}
549+
headers = {}
549550
headers.update(create_headers_for_test())
550551
responses.add(
551552
responses.POST,
@@ -624,7 +625,7 @@ def test_create_custom_metadata_fields_succeeds_with_type_boolean(self):
624625
"""
625626
URL.API_BASE_URL = "http://test.com"
626627
url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL)
627-
headers = {"Content-Type": "application/json"}
628+
headers = {}
628629
headers.update(create_headers_for_test())
629630
responses.add(
630631
responses.POST,
@@ -703,7 +704,7 @@ def test_create_custom_metadata_fields_succeeds_with_type_single_select(self):
703704
"""
704705
URL.API_BASE_URL = "http://test.com"
705706
url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL)
706-
headers = {"Content-Type": "application/json"}
707+
headers = {}
707708
headers.update(create_headers_for_test())
708709
responses.add(
709710
responses.POST,
@@ -780,7 +781,7 @@ def test_create_custom_metadata_fields_succeeds_with_type_multi_select(self):
780781
"""
781782
URL.API_BASE_URL = "http://test.com"
782783
url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL)
783-
headers = {"Content-Type": "application/json"}
784+
headers = {}
784785
headers.update(create_headers_for_test())
785786
responses.add(
786787
responses.POST,
@@ -863,7 +864,7 @@ def test_update_custom_metadata_fields_succeeds(self):
863864
"""
864865
URL.API_BASE_URL = "http://test.com"
865866
url = "{}/v1/customMetadataFields/{}".format(URL.API_BASE_URL, self.field_id)
866-
headers = {"Content-Type": "application/json"}
867+
headers = {}
867868
headers.update(create_headers_for_test())
868869
responses.add(
869870
responses.PATCH,

tests/test_files_ops.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ def test_bulk_file_delete_succeeds(self):
11551155

11561156
URL.API_BASE_URL = "http://test.com"
11571157
url = URL.API_BASE_URL + "/v1/files" + URL.BULK_FILE_DELETE
1158-
headers = {"Content-Type": "application/json"}
1158+
headers = {}
11591159
headers.update(get_auth_headers_for_test())
11601160

11611161
responses.add(
@@ -1197,7 +1197,7 @@ def test_bulk_file_delete_succeeds_and_recieves_extra_non_breaking_changes_from_
11971197

11981198
URL.API_BASE_URL = "http://test.com"
11991199
url = URL.API_BASE_URL + "/v1/files" + URL.BULK_FILE_DELETE
1200-
headers = {"Content-Type": "application/json"}
1200+
headers = {}
12011201
headers.update(get_auth_headers_for_test())
12021202

12031203
responses.add(
@@ -1237,7 +1237,7 @@ def test_bulk_file_delete_fails_with_404_exception(self) -> None:
12371237

12381238
URL.API_BASE_URL = "http://test.com"
12391239
url = URL.API_BASE_URL + "/v1/files" + URL.BULK_FILE_DELETE
1240-
headers = {"Content-Type": "application/json"}
1240+
headers = {}
12411241
headers.update(get_auth_headers_for_test())
12421242
try:
12431243
responses.add(
@@ -1269,7 +1269,7 @@ def test_file_delete_fails_with_400_exception(self):
12691269

12701270
URL.API_BASE_URL = "http://test.com"
12711271
url = "{}/v1/files/{}".format(URL.API_BASE_URL, self.file_id)
1272-
headers = {"Content-Type": "application/json"}
1272+
headers = {}
12731273
headers.update(get_auth_headers_for_test())
12741274
try:
12751275
responses.add(
@@ -1297,7 +1297,7 @@ def test_file_delete_succeeds(self):
12971297
"""
12981298
URL.API_BASE_URL = "http://test.com"
12991299
url = "{}/v1/files/{}".format(URL.API_BASE_URL, self.file_id)
1300-
headers = {"Content-Type": "application/json"}
1300+
headers = {}
13011301
headers.update(get_auth_headers_for_test())
13021302

13031303
responses.add(responses.DELETE, url , status=204, headers=headers, content_type="application/json")
@@ -1656,7 +1656,7 @@ def test_update_file_details_succeeds_with_id(self):
16561656
"""
16571657
URL.API_BASE_URL = "http://test.com"
16581658
url = "{}/v1/files/{}/details/".format(URL.API_BASE_URL, self.file_id)
1659-
headers = {"Content-Type": "application/json"}
1659+
headers = {}
16601660
headers.update(get_auth_headers_for_test())
16611661
responses.add(
16621662
responses.PATCH,
@@ -1818,7 +1818,7 @@ def test_update_file_publish_status_succeeds_(self):
18181818
"""
18191819
URL.API_BASE_URL = "http://test.com"
18201820
url = "{}/v1/files/{}/details/".format(URL.API_BASE_URL, self.file_id)
1821-
headers = {"Content-Type": "application/json"}
1821+
headers = {}
18221822
headers.update(get_auth_headers_for_test())
18231823
responses.add(
18241824
responses.PATCH,
@@ -2032,7 +2032,7 @@ def test_get_file_versions_succeeds_with_id(self):
20322032
URL.API_BASE_URL = "http://test.com"
20332033
url = "{}/v1/files/{}/versions".format(URL.API_BASE_URL, self.file_id)
20342034

2035-
headers = {"Content-Type": "application/json"}
2035+
headers = {}
20362036
headers.update(get_auth_headers_for_test())
20372037
responses.add(
20382038
responses.GET,
@@ -2300,7 +2300,7 @@ def test_get_file_version_details_succeeds_with_id(self):
23002300
URL.API_BASE_URL, self.file_id, self.version_id
23012301
)
23022302

2303-
headers = {"Content-Type": "application/json"}
2303+
headers = {}
23042304
headers.update(get_auth_headers_for_test())
23052305
responses.add(
23062306
responses.GET,
@@ -2470,7 +2470,7 @@ def test_delete_file_version_succeeds(self) -> None:
24702470
url = "{}/v1/files/{}/versions/{}".format(
24712471
URL.API_BASE_URL, self.file_id, self.version_id
24722472
)
2473-
headers = {"Content-Type": "application/json"}
2473+
headers = {}
24742474
headers.update(create_headers_for_test())
24752475
responses.add(responses.DELETE, url, status=204, headers=headers, content_type="application/json")
24762476
resp = self.client.delete_file_version(self.file_id, self.version_id)
@@ -2506,7 +2506,7 @@ def test_copy_file_fails_with_404(self) -> None:
25062506

25072507
URL.API_BASE_URL = "http://test.com"
25082508
url = "{}/v1/files/copy".format(URL.API_BASE_URL)
2509-
headers = {"Content-Type": "application/json"}
2509+
headers = {}
25102510
headers.update(create_headers_for_test())
25112511
responses.add(
25122512
responses.POST,
@@ -2538,7 +2538,7 @@ def test_copy_file_succeeds(self) -> None:
25382538

25392539
URL.API_BASE_URL = "http://test.com"
25402540
url = "{}/v1/files/copy".format(URL.API_BASE_URL)
2541-
headers = {"Content-Type": "application/json"}
2541+
headers = {}
25422542
headers.update(create_headers_for_test())
25432543
responses.add(responses.POST, url, status=204, headers=headers, content_type="application/json")
25442544

@@ -2585,7 +2585,7 @@ def test_copy_file_succeeds_without_include_file_versions(self) -> None:
25852585

25862586
URL.API_BASE_URL = "http://test.com"
25872587
url = "{}/v1/files/copy".format(URL.API_BASE_URL)
2588-
headers = {"Content-Type": "application/json"}
2588+
headers = {}
25892589
headers.update(create_headers_for_test())
25902590
responses.add(responses.POST, url, status=204, headers=headers, content_type="application/json")
25912591

@@ -2636,7 +2636,7 @@ def test_move_file_fails_with_404(self) -> None:
26362636

26372637
URL.API_BASE_URL = "http://test.com"
26382638
url = "{}/v1/files/move".format(URL.API_BASE_URL)
2639-
headers = {"Content-Type": "application/json"}
2639+
headers = {}
26402640
headers.update(create_headers_for_test())
26412641
responses.add(
26422642
responses.POST,
@@ -2667,7 +2667,7 @@ def test_move_file_succeeds(self) -> None:
26672667

26682668
URL.API_BASE_URL = "http://test.com"
26692669
url = "{}/v1/files/move".format(URL.API_BASE_URL)
2670-
headers = {"Content-Type": "application/json"}
2670+
headers = {}
26712671
headers.update(create_headers_for_test())
26722672
responses.add(responses.POST, url, status=204, headers=headers, content_type="application/json")
26732673

@@ -2717,7 +2717,7 @@ def test_rename_file_fails_with_409(self) -> None:
27172717

27182718
URL.API_BASE_URL = "http://test.com"
27192719
url = "{}/v1/files/rename".format(URL.API_BASE_URL)
2720-
headers = {"Content-Type": "application/json"}
2720+
headers = {}
27212721
headers.update(create_headers_for_test())
27222722
try:
27232723
responses.add(
@@ -2751,7 +2751,7 @@ def test_rename_file_succeeds_with_purge_cache_false(self) -> None:
27512751

27522752
URL.API_BASE_URL = "http://test.com"
27532753
url = "{}/v1/files/rename".format(URL.API_BASE_URL)
2754-
headers = {"Content-Type": "application/json"}
2754+
headers = {}
27552755
headers.update(create_headers_for_test())
27562756
responses.add(
27572757
responses.PUT,
@@ -2804,7 +2804,7 @@ def test_rename_file_succeeds_with_purge_cache(self) -> None:
28042804

28052805
URL.API_BASE_URL = "http://test.com"
28062806
url = "{}/v1/files/rename".format(URL.API_BASE_URL)
2807-
headers = {"Content-Type": "application/json"}
2807+
headers = {}
28082808
headers.update(create_headers_for_test())
28092809
responses.add(
28102810
responses.PUT,
@@ -2857,9 +2857,9 @@ def test_rename_file_succeeds(self) -> None:
28572857

28582858
URL.API_BASE_URL = "http://test.com"
28592859
url = "{}/v1/files/rename".format(URL.API_BASE_URL)
2860-
headers = {"Content-Type": "application/json"}
2860+
headers = {}
28612861
headers.update(create_headers_for_test())
2862-
responses.add(responses.PUT, url, headers=headers, body="{}")
2862+
responses.add(responses.PUT, url, headers=headers, body="{}", content_type="application/json")
28632863
resp = self.client.rename_file(
28642864
options=RenameFileRequestOptions(
28652865
file_path=self.file_path, new_file_name=self.new_file_name
@@ -2929,7 +2929,7 @@ def test_restore_file_version_succeeds(self) -> None:
29292929
url = "{}/v1/files/{}/versions/{}/restore".format(
29302930
URL.API_BASE_URL, self.file_id, self.version_id
29312931
)
2932-
headers = {"Content-Type": "application/json"}
2932+
headers = {}
29332933
headers.update(create_headers_for_test())
29342934
responses.add(
29352935
responses.PUT,
@@ -3018,7 +3018,7 @@ def test_restore_file_version_succeeds(self) -> None:
30183018
def test_get_metadata_with_non_breaking_changes_in_response(self):
30193019
URL.API_BASE_URL = "http://test.com"
30203020
url = "{}/v1/files/{}/metadata".format(URL.API_BASE_URL, self.file_id)
3021-
headers = {"Content-Type": "application/json"}
3021+
headers = {}
30223022
headers.update(create_headers_for_test())
30233023
responses.add(
30243024
responses.GET,

tests/test_tags_ops.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_add_tags_succeeds(self):
5959
"""
6060
URL.API_BASE_URL = "http://test.com"
6161
url = "{}/v1/files/addTags".format(URL.API_BASE_URL)
62-
headers = {"Content-Type": "application/json"}
62+
headers = {}
6363
headers.update(get_auth_headers_for_test())
6464
responses.add(
6565
responses.POST,
@@ -104,7 +104,7 @@ def test_add_tags_fails_with_404_exception(self) -> None:
104104

105105
URL.API_BASE_URL = "http://test.com"
106106
url = "{}/v1/files/addTags".format(URL.API_BASE_URL)
107-
headers = {"Content-Type": "application/json"}
107+
headers = {}
108108
headers.update(get_auth_headers_for_test())
109109
try:
110110
responses.add(
@@ -157,7 +157,7 @@ def test_remove_tags_succeeds(self):
157157
"""
158158
URL.API_BASE_URL = "http://test.com"
159159
url = "{}/v1/files/removeTags".format(URL.API_BASE_URL)
160-
headers = {"Content-Type": "application/json"}
160+
headers = {}
161161
headers.update(get_auth_headers_for_test())
162162
responses.add(
163163
responses.POST,
@@ -202,7 +202,7 @@ def test_remove_tags_fails_with_404_exception(self) -> None:
202202

203203
URL.API_BASE_URL = "http://test.com"
204204
url = "{}/v1/files/removeTags".format(URL.API_BASE_URL)
205-
headers = {"Content-Type": "application/json"}
205+
headers = {}
206206
headers.update(get_auth_headers_for_test())
207207
try:
208208
responses.add(
@@ -268,7 +268,7 @@ def test_remove_ai_tags_succeeds(self):
268268
"""
269269
URL.API_BASE_URL = "http://test.com"
270270
url = "{}/v1/files/removeAITags".format(URL.API_BASE_URL)
271-
headers = {"Content-Type": "application/json"}
271+
headers = {}
272272
headers.update(get_auth_headers_for_test())
273273
responses.add(
274274
responses.POST,
@@ -313,7 +313,7 @@ def test_remove_ai_tags_fails_with_404_exception(self) -> None:
313313

314314
URL.API_BASE_URL = "http://test.com"
315315
url = "{}/v1/files/removeAITags".format(URL.API_BASE_URL)
316-
headers = {"Content-Type": "application/json"}
316+
headers = {}
317317
headers.update(get_auth_headers_for_test())
318318
try:
319319
responses.add(

0 commit comments

Comments
 (0)