@@ -24,7 +24,11 @@ const AVAILABLE_AFTER: TimeDelta = TimeDelta::hours(24);
24
24
/// crate has been published for less than 72 hours, or if the crate has a
25
25
/// single owner, has been downloaded less than 100 times for each month it has
26
26
/// been published, and is not depended upon by any other crate on crates.io.
27
- pub async fn delete ( Path ( name) : Path < String > , parts : Parts , app : AppState ) -> AppResult < ( ) > {
27
+ pub async fn delete (
28
+ Path ( name) : Path < String > ,
29
+ parts : Parts ,
30
+ app : AppState ,
31
+ ) -> AppResult < StatusCode > {
28
32
let mut conn = app. db_write ( ) . await ?;
29
33
30
34
// Check that the user is authenticated
@@ -107,7 +111,7 @@ pub async fn delete(Path(name): Path<String>, parts: Parts, app: AppState) -> Ap
107
111
} )
108
112
. await ?;
109
113
110
- Ok ( ( ) )
114
+ Ok ( StatusCode :: NO_CONTENT )
111
115
}
112
116
113
117
async fn find_crate ( conn : & mut AsyncPgConnection , name : & str ) -> QueryResult < Option < Crate > > {
@@ -177,7 +181,7 @@ mod tests {
177
181
" ) ;
178
182
179
183
let response = delete_crate ( & user, "foo" ) . await ;
180
- assert_eq ! ( response. status( ) , StatusCode :: OK ) ;
184
+ assert_eq ! ( response. status( ) , StatusCode :: NO_CONTENT ) ;
181
185
assert ! ( response. body( ) . is_empty( ) ) ;
182
186
183
187
// Assert that the crate no longer exists
@@ -212,7 +216,7 @@ mod tests {
212
216
" ) ;
213
217
214
218
let response = delete_crate ( & user, "foo" ) . await ;
215
- assert_eq ! ( response. status( ) , StatusCode :: OK ) ;
219
+ assert_eq ! ( response. status( ) , StatusCode :: NO_CONTENT ) ;
216
220
assert ! ( response. body( ) . is_empty( ) ) ;
217
221
218
222
// Assert that the crate no longer exists
@@ -247,7 +251,7 @@ mod tests {
247
251
" ) ;
248
252
249
253
let response = delete_crate ( & user, "foo" ) . await ;
250
- assert_eq ! ( response. status( ) , StatusCode :: OK ) ;
254
+ assert_eq ! ( response. status( ) , StatusCode :: NO_CONTENT ) ;
251
255
assert ! ( response. body( ) . is_empty( ) ) ;
252
256
253
257
// Assert that the crate no longer exists
0 commit comments