Skip to content

Commit b45d56c

Browse files
MalteBeckerdbanty
andauthored
feat: Use httpx.request to allow bodies for all type of requests [#545, #547]. Thanks @MalteBecker!
Co-authored-by: Dylan Anthony <[email protected]>
1 parent 19dd9d8 commit b45d56c

27 files changed

+81
-54
lines changed

end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def _get_kwargs(
2222
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
2323

2424
return {
25+
"method": "get",
2526
"url": url,
2627
"headers": headers,
2728
"cookies": cookies,
@@ -57,7 +58,7 @@ def sync_detailed(
5758
common=common,
5859
)
5960

60-
response = httpx.get(
61+
response = httpx.request(
6162
verify=client.verify_ssl,
6263
**kwargs,
6364
)
@@ -84,6 +85,6 @@ async def asyncio_detailed(
8485
)
8586

8687
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
87-
response = await _client.get(**kwargs)
88+
response = await _client.request(**kwargs)
8889

8990
return _build_response(response=response)

end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def _get_kwargs(
2222
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
2323

2424
return {
25+
"method": "post",
2526
"url": url,
2627
"headers": headers,
2728
"cookies": cookies,
@@ -57,7 +58,7 @@ def sync_detailed(
5758
common=common,
5859
)
5960

60-
response = httpx.post(
61+
response = httpx.request(
6162
verify=client.verify_ssl,
6263
**kwargs,
6364
)
@@ -84,6 +85,6 @@ async def asyncio_detailed(
8485
)
8586

8687
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
87-
response = await _client.post(**kwargs)
88+
response = await _client.request(**kwargs)
8889

8990
return _build_response(response=response)

end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def _get_kwargs(
4343
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
4444

4545
return {
46+
"method": "get",
4647
"url": url,
4748
"headers": headers,
4849
"cookies": cookies,
@@ -87,7 +88,7 @@ def sync_detailed(
8788
not_null_not_required=not_null_not_required,
8889
)
8990

90-
response = httpx.get(
91+
response = httpx.request(
9192
verify=client.verify_ssl,
9293
**kwargs,
9394
)
@@ -123,6 +124,6 @@ async def asyncio_detailed(
123124
)
124125

125126
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
126-
response = await _client.get(**kwargs)
127+
response = await _client.request(**kwargs)
127128

128129
return _build_response(response=response)

end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def _get_kwargs(
2323
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
2424

2525
return {
26+
"method": "delete",
2627
"url": url,
2728
"headers": headers,
2829
"cookies": cookies,
@@ -61,7 +62,7 @@ def sync_detailed(
6162
param_query=param_query,
6263
)
6364

64-
response = httpx.delete(
65+
response = httpx.request(
6566
verify=client.verify_ssl,
6667
**kwargs,
6768
)
@@ -91,6 +92,6 @@ async def asyncio_detailed(
9192
)
9293

9394
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
94-
response = await _client.delete(**kwargs)
95+
response = await _client.request(**kwargs)
9596

9697
return _build_response(response=response)

end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def _get_kwargs(
2323
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
2424

2525
return {
26+
"method": "get",
2627
"url": url,
2728
"headers": headers,
2829
"cookies": cookies,
@@ -63,7 +64,7 @@ def sync_detailed(
6364
param_query=param_query,
6465
)
6566

66-
response = httpx.get(
67+
response = httpx.request(
6768
verify=client.verify_ssl,
6869
**kwargs,
6970
)
@@ -95,6 +96,6 @@ async def asyncio_detailed(
9596
)
9697

9798
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
98-
response = await _client.get(**kwargs)
99+
response = await _client.request(**kwargs)
99100

100101
return _build_response(response=response)

end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def _get_kwargs(
3131
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
3232

3333
return {
34+
"method": "get",
3435
"url": url,
3536
"headers": headers,
3637
"cookies": cookies,
@@ -75,7 +76,7 @@ def sync_detailed(
7576
param_cookie=param_cookie,
7677
)
7778

78-
response = httpx.get(
79+
response = httpx.request(
7980
verify=client.verify_ssl,
8081
**kwargs,
8182
)
@@ -111,6 +112,6 @@ async def asyncio_detailed(
111112
)
112113

113114
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
114-
response = await _client.get(**kwargs)
115+
response = await _client.request(**kwargs)
115116

116117
return _build_response(response=response)

end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def _get_kwargs(
2222
cookies: Dict[str, Any] = client.get_cookies()
2323

2424
return {
25+
"method": "get",
2526
"url": url,
2627
"headers": headers,
2728
"cookies": cookies,
@@ -65,7 +66,7 @@ def sync_detailed(
6566
client=client,
6667
)
6768

68-
response = httpx.get(
69+
response = httpx.request(
6970
verify=client.verify_ssl,
7071
**kwargs,
7172
)
@@ -101,6 +102,6 @@ async def asyncio_detailed(
101102
)
102103

103104
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
104-
response = await _client.get(**kwargs)
105+
response = await _client.request(**kwargs)
105106

106107
return _build_response(response=response)

end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def _get_kwargs(
1616
cookies: Dict[str, Any] = client.get_cookies()
1717

1818
return {
19+
"method": "get",
1920
"url": url,
2021
"headers": headers,
2122
"cookies": cookies,
@@ -45,7 +46,7 @@ def sync_detailed(
4546
client=client,
4647
)
4748

48-
response = httpx.get(
49+
response = httpx.request(
4950
verify=client.verify_ssl,
5051
**kwargs,
5152
)
@@ -67,6 +68,6 @@ async def asyncio_detailed(
6768
)
6869

6970
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
70-
response = await _client.get(**kwargs)
71+
response = await _client.request(**kwargs)
7172

7273
return _build_response(response=response)

end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def _get_kwargs(
7575
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
7676

7777
return {
78+
"method": "post",
7879
"url": url,
7980
"headers": headers,
8081
"cookies": cookies,
@@ -153,7 +154,7 @@ def sync_detailed(
153154
required_model_prop=required_model_prop,
154155
)
155156

156-
response = httpx.post(
157+
response = httpx.request(
157158
verify=client.verify_ssl,
158159
**kwargs,
159160
)
@@ -261,7 +262,7 @@ async def asyncio_detailed(
261262
)
262263

263264
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
264-
response = await _client.post(**kwargs)
265+
response = await _client.request(**kwargs)
265266

266267
return _build_response(response=response)
267268

end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def _get_kwargs(
1616
cookies: Dict[str, Any] = client.get_cookies()
1717

1818
return {
19+
"method": "get",
1920
"url": url,
2021
"headers": headers,
2122
"cookies": cookies,
@@ -56,7 +57,7 @@ def sync_detailed(
5657
client=client,
5758
)
5859

59-
response = httpx.get(
60+
response = httpx.request(
6061
verify=client.verify_ssl,
6162
**kwargs,
6263
)
@@ -98,7 +99,7 @@ async def asyncio_detailed(
9899
)
99100

100101
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
101-
response = await _client.get(**kwargs)
102+
response = await _client.request(**kwargs)
102103

103104
return _build_response(response=response)
104105

end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def _get_kwargs(
1616
cookies: Dict[str, Any] = client.get_cookies()
1717

1818
return {
19+
"method": "get",
1920
"url": url,
2021
"headers": headers,
2122
"cookies": cookies,
@@ -56,7 +57,7 @@ def sync_detailed(
5657
client=client,
5758
)
5859

59-
response = httpx.get(
60+
response = httpx.request(
6061
verify=client.verify_ssl,
6162
**kwargs,
6263
)
@@ -98,7 +99,7 @@ async def asyncio_detailed(
9899
)
99100

100101
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
101-
response = await _client.get(**kwargs)
102+
response = await _client.request(**kwargs)
102103

103104
return _build_response(response=response)
104105

end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def _get_kwargs(
1616
cookies: Dict[str, Any] = client.get_cookies()
1717

1818
return {
19+
"method": "get",
1920
"url": url,
2021
"headers": headers,
2122
"cookies": cookies,
@@ -56,7 +57,7 @@ def sync_detailed(
5657
client=client,
5758
)
5859

59-
response = httpx.get(
60+
response = httpx.request(
6061
verify=client.verify_ssl,
6162
**kwargs,
6263
)
@@ -98,7 +99,7 @@ async def asyncio_detailed(
9899
)
99100

100101
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
101-
response = await _client.get(**kwargs)
102+
response = await _client.request(**kwargs)
102103

103104
return _build_response(response=response)
104105

end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def _get_kwargs(
1616
cookies: Dict[str, Any] = client.get_cookies()
1717

1818
return {
19+
"method": "get",
1920
"url": url,
2021
"headers": headers,
2122
"cookies": cookies,
@@ -56,7 +57,7 @@ def sync_detailed(
5657
client=client,
5758
)
5859

59-
response = httpx.get(
60+
response = httpx.request(
6061
verify=client.verify_ssl,
6162
**kwargs,
6263
)
@@ -98,7 +99,7 @@ async def asyncio_detailed(
9899
)
99100

100101
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
101-
response = await _client.get(**kwargs)
102+
response = await _client.request(**kwargs)
102103

103104
return _build_response(response=response)
104105

end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def _get_kwargs(
5454
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
5555

5656
return {
57+
"method": "get",
5758
"url": url,
5859
"headers": headers,
5960
"cookies": cookies,
@@ -122,7 +123,7 @@ def sync_detailed(
122123
some_date=some_date,
123124
)
124125

125-
response = httpx.get(
126+
response = httpx.request(
126127
verify=client.verify_ssl,
127128
**kwargs,
128129
)
@@ -192,7 +193,7 @@ async def asyncio_detailed(
192193
)
193194

194195
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
195-
response = await _client.get(**kwargs)
196+
response = await _client.request(**kwargs)
196197

197198
return _build_response(response=response)
198199

end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def _get_kwargs(
2626
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
2727

2828
return {
29+
"method": "post",
2930
"url": url,
3031
"headers": headers,
3132
"cookies": cookies,
@@ -74,7 +75,7 @@ def sync_detailed(
7475
int_enum=int_enum,
7576
)
7677

77-
response = httpx.post(
78+
response = httpx.request(
7879
verify=client.verify_ssl,
7980
**kwargs,
8081
)
@@ -122,7 +123,7 @@ async def asyncio_detailed(
122123
)
123124

124125
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
125-
response = await _client.post(**kwargs)
126+
response = await _client.request(**kwargs)
126127

127128
return _build_response(response=response)
128129

0 commit comments

Comments
 (0)