Skip to content

Commit ad0d88e

Browse files
committed
fix(test): use data parameter instead of json
1 parent ea7a35b commit ad0d88e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/flexible/cookie_form.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _() -> tuple[tuple[str, str], ...]:
6868
payload: dict[str, str] = {"csrf-token": csrf_token} if csrf_token is not None else {}
6969

7070
### Post to protected endpoint ###
71-
response = flexible_client.post("/protected", json=payload)
71+
response = flexible_client.post("/protected", data=payload, headers=headers)
7272

7373
### Assertions ###
7474
assert response.status_code == 200
@@ -77,7 +77,7 @@ def _() -> tuple[tuple[str, str], ...]:
7777
assert cookie_token is None
7878

7979
### Immediately get protected contents again ###
80-
response = flexible_client.post("/protected", json=payload, headers=headers)
80+
response = flexible_client.post("/protected", data=payload, headers=headers)
8181

8282
### Assertions ###
8383
assert response.status_code == 400
@@ -119,7 +119,7 @@ def _() -> tuple[tuple[str, str], ...]:
119119
payload: dict[str, str] = {"csrf-token": csrf_token} if csrf_token is not None else {}
120120

121121
### Post to protected endpoint but fails because TestClients defaults to http ###
122-
response = flexible_client.post("/protected", json=payload, headers=headers)
122+
response = flexible_client.post("/protected", data=payload, headers=headers)
123123

124124
### Assertions ###
125125
assert response.status_code == 400
@@ -187,7 +187,7 @@ def _() -> tuple[tuple[str, str], ...]:
187187
payload: dict[str, str] = {"csrf-token": csrf_token} if csrf_token is not None else {}
188188

189189
### Post to protected endpoint ###
190-
response = flexible_client.post("/protected", json=payload, headers=headers)
190+
response = flexible_client.post("/protected", data=payload, headers=headers)
191191

192192
### Assertions ###
193193
assert response.status_code == 200
@@ -196,7 +196,7 @@ def _() -> tuple[tuple[str, str], ...]:
196196
assert cookie_token is None
197197

198198
### Immediately get protected contents again ###
199-
response = flexible_client.post("/protected", json=payload, headers=headers)
199+
response = flexible_client.post("/protected", data=payload, headers=headers)
200200

201201
### Assertions ###
202202
assert response.status_code == 400

0 commit comments

Comments
 (0)