@@ -72,7 +72,7 @@ async fn test_happy_path() -> anyhow::Result<()> {
72
72
let client = prepare ( ) . await ?;
73
73
74
74
let body = default_claims ( ) . as_exchange_body ( ) ?;
75
- let response = client. put :: < ( ) > ( URL , body) . await ;
75
+ let response = client. post :: < ( ) > ( URL , body) . await ;
76
76
assert_snapshot ! ( response. status( ) , @"200 OK" ) ;
77
77
78
78
let json = response. json ( ) ;
@@ -108,7 +108,7 @@ async fn test_happy_path_with_environment() -> anyhow::Result<()> {
108
108
claims. environment = Some ( "prod" . into ( ) ) ;
109
109
110
110
let body = claims. as_exchange_body ( ) ?;
111
- let response = client. put :: < ( ) > ( URL , body) . await ;
111
+ let response = client. post :: < ( ) > ( URL , body) . await ;
112
112
assert_snapshot ! ( response. status( ) , @"200 OK" ) ;
113
113
114
114
Ok ( ( ) )
@@ -122,7 +122,7 @@ async fn test_happy_path_with_ignored_environment() -> anyhow::Result<()> {
122
122
claims. environment = Some ( "prod" . into ( ) ) ;
123
123
124
124
let body = claims. as_exchange_body ( ) ?;
125
- let response = client. put :: < ( ) > ( URL , body) . await ;
125
+ let response = client. post :: < ( ) > ( URL , body) . await ;
126
126
assert_snapshot ! ( response. status( ) , @"200 OK" ) ;
127
127
128
128
Ok ( ( ) )
@@ -133,7 +133,7 @@ async fn test_broken_jwt() -> anyhow::Result<()> {
133
133
let client = prepare ( ) . await ?;
134
134
135
135
let body = serde_json:: to_vec ( & json ! ( { "jwt" : "broken" } ) ) ?;
136
- let response = client. put :: < ( ) > ( URL , body) . await ;
136
+ let response = client. post :: < ( ) > ( URL , body) . await ;
137
137
assert_snapshot ! ( response. status( ) , @"400 Bad Request" ) ;
138
138
assert_snapshot ! ( response. json( ) , @r#"{"errors":[{"detail":"Failed to decode JWT"}]}"# ) ;
139
139
@@ -154,7 +154,7 @@ async fn test_unsupported_issuer() -> anyhow::Result<()> {
154
154
new_oidc_config ( krate. id ) . insert ( & mut conn) . await ?;
155
155
156
156
let body = default_claims ( ) . as_exchange_body ( ) ?;
157
- let response = client. put :: < ( ) > ( URL , body) . await ;
157
+ let response = client. post :: < ( ) > ( URL , body) . await ;
158
158
assert_snapshot ! ( response. status( ) , @"400 Bad Request" ) ;
159
159
assert_snapshot ! ( response. json( ) , @r#"{"errors":[{"detail":"Unsupported JWT issuer"}]}"# ) ;
160
160
@@ -170,7 +170,7 @@ async fn test_missing_key_id() -> anyhow::Result<()> {
170
170
let jwt = jsonwebtoken:: encode ( & Header :: default ( ) , & claims, & secret_key) ?;
171
171
let body = serde_json:: to_vec ( & json ! ( { "jwt" : jwt } ) ) ?;
172
172
173
- let response = client. put :: < ( ) > ( URL , body) . await ;
173
+ let response = client. post :: < ( ) > ( URL , body) . await ;
174
174
assert_snapshot ! ( response. status( ) , @"400 Bad Request" ) ;
175
175
assert_snapshot ! ( response. json( ) , @r#"{"errors":[{"detail":"Missing JWT key ID"}]}"# ) ;
176
176
@@ -198,7 +198,7 @@ async fn test_unknown_key() -> anyhow::Result<()> {
198
198
new_oidc_config ( krate. id ) . insert ( & mut conn) . await ?;
199
199
200
200
let body = default_claims ( ) . as_exchange_body ( ) ?;
201
- let response = client. put :: < ( ) > ( URL , body) . await ;
201
+ let response = client. post :: < ( ) > ( URL , body) . await ;
202
202
assert_snapshot ! ( response. status( ) , @"400 Bad Request" ) ;
203
203
assert_snapshot ! ( response. json( ) , @r#"{"errors":[{"detail":"Invalid JWT key ID"}]}"# ) ;
204
204
@@ -226,7 +226,7 @@ async fn test_key_store_error() -> anyhow::Result<()> {
226
226
new_oidc_config ( krate. id ) . insert ( & mut conn) . await ?;
227
227
228
228
let body = default_claims ( ) . as_exchange_body ( ) ?;
229
- let response = client. put :: < ( ) > ( URL , body) . await ;
229
+ let response = client. post :: < ( ) > ( URL , body) . await ;
230
230
assert_snapshot ! ( response. status( ) , @"500 Internal Server Error" ) ;
231
231
assert_snapshot ! ( response. json( ) , @r#"{"errors":[{"detail":"Failed to load OIDC key set"}]}"# ) ;
232
232
@@ -241,7 +241,7 @@ async fn test_invalid_audience() -> anyhow::Result<()> {
241
241
claims. aud = "invalid-audience" . into ( ) ;
242
242
243
243
let body = claims. as_exchange_body ( ) ?;
244
- let response = client. put :: < ( ) > ( URL , body) . await ;
244
+ let response = client. post :: < ( ) > ( URL , body) . await ;
245
245
assert_snapshot ! ( response. status( ) , @"400 Bad Request" ) ;
246
246
assert_snapshot ! ( response. json( ) , @r#"{"errors":[{"detail":"Failed to decode JWT"}]}"# ) ;
247
247
@@ -256,11 +256,11 @@ async fn test_token_reuse() -> anyhow::Result<()> {
256
256
let body = default_claims ( ) . as_exchange_body ( ) ?;
257
257
258
258
// The first exchange should succeed
259
- let response = client. put :: < ( ) > ( URL , body. clone ( ) ) . await ;
259
+ let response = client. post :: < ( ) > ( URL , body. clone ( ) ) . await ;
260
260
assert_snapshot ! ( response. status( ) , @"200 OK" ) ;
261
261
262
262
// The second exchange should fail
263
- let response = client. put :: < ( ) > ( URL , body) . await ;
263
+ let response = client. post :: < ( ) > ( URL , body) . await ;
264
264
assert_snapshot ! ( response. status( ) , @"400 Bad Request" ) ;
265
265
assert_snapshot ! ( response. json( ) , @r#"{"errors":[{"detail":"JWT has already been used"}]}"# ) ;
266
266
@@ -275,7 +275,7 @@ async fn test_invalid_repository() -> anyhow::Result<()> {
275
275
claims. repository = "what?" . into ( ) ;
276
276
277
277
let body = claims. as_exchange_body ( ) ?;
278
- let response = client. put :: < ( ) > ( URL , body) . await ;
278
+ let response = client. post :: < ( ) > ( URL , body) . await ;
279
279
assert_snapshot ! ( response. status( ) , @"400 Bad Request" ) ;
280
280
assert_snapshot ! ( response. json( ) , @r#"{"errors":[{"detail":"Unexpected `repository` value"}]}"# ) ;
281
281
@@ -290,7 +290,7 @@ async fn test_invalid_workflow() -> anyhow::Result<()> {
290
290
claims. workflow_ref = "what?" . into ( ) ;
291
291
292
292
let body = claims. as_exchange_body ( ) ?;
293
- let response = client. put :: < ( ) > ( URL , body) . await ;
293
+ let response = client. post :: < ( ) > ( URL , body) . await ;
294
294
assert_snapshot ! ( response. status( ) , @"400 Bad Request" ) ;
295
295
assert_snapshot ! ( response. json( ) , @r#"{"errors":[{"detail":"Unexpected `workflow_ref` value"}]}"# ) ;
296
296
@@ -305,7 +305,7 @@ async fn test_invalid_owner_id() -> anyhow::Result<()> {
305
305
claims. repository_owner_id = "what?" . into ( ) ;
306
306
307
307
let body = claims. as_exchange_body ( ) ?;
308
- let response = client. put :: < ( ) > ( URL , body) . await ;
308
+ let response = client. post :: < ( ) > ( URL , body) . await ;
309
309
assert_snapshot ! ( response. status( ) , @"400 Bad Request" ) ;
310
310
assert_snapshot ! ( response. json( ) , @r#"{"errors":[{"detail":"Unexpected `repository_owner_id` value"}]}"# ) ;
311
311
@@ -320,7 +320,7 @@ async fn test_missing_config() -> anyhow::Result<()> {
320
320
. await ;
321
321
322
322
let body = default_claims ( ) . as_exchange_body ( ) ?;
323
- let response = client. put :: < ( ) > ( URL , body) . await ;
323
+ let response = client. post :: < ( ) > ( URL , body) . await ;
324
324
assert_snapshot ! ( response. status( ) , @"400 Bad Request" ) ;
325
325
assert_snapshot ! ( response. json( ) , @r#"{"errors":[{"detail":"No matching Trusted Publishing config found"}]}"# ) ;
326
326
@@ -332,7 +332,7 @@ async fn test_missing_environment() -> anyhow::Result<()> {
332
332
let client = prepare_with_config ( |c| c. environment = Some ( "prod" ) ) . await ?;
333
333
334
334
let body = default_claims ( ) . as_exchange_body ( ) ?;
335
- let response = client. put :: < ( ) > ( URL , body) . await ;
335
+ let response = client. post :: < ( ) > ( URL , body) . await ;
336
336
assert_snapshot ! ( response. status( ) , @"400 Bad Request" ) ;
337
337
assert_snapshot ! ( response. json( ) , @r#"{"errors":[{"detail":"No matching Trusted Publishing config found"}]}"# ) ;
338
338
@@ -347,7 +347,7 @@ async fn test_wrong_environment() -> anyhow::Result<()> {
347
347
claims. environment = Some ( "not-prod" . into ( ) ) ;
348
348
349
349
let body = claims. as_exchange_body ( ) ?;
350
- let response = client. put :: < ( ) > ( URL , body) . await ;
350
+ let response = client. post :: < ( ) > ( URL , body) . await ;
351
351
assert_snapshot ! ( response. status( ) , @"400 Bad Request" ) ;
352
352
assert_snapshot ! ( response. json( ) , @r#"{"errors":[{"detail":"No matching Trusted Publishing config found"}]}"# ) ;
353
353
@@ -369,7 +369,7 @@ async fn test_case_insensitive() -> anyhow::Result<()> {
369
369
. build ( ) ;
370
370
371
371
let body = claims. as_exchange_body ( ) ?;
372
- let response = client. put :: < ( ) > ( URL , body) . await ;
372
+ let response = client. post :: < ( ) > ( URL , body) . await ;
373
373
assert_snapshot ! ( response. status( ) , @"200 OK" ) ;
374
374
375
375
Ok ( ( ) )
0 commit comments