File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -99,11 +99,7 @@ pub fn download(req: &mut dyn RequestExt) -> EndpointResult {
9999 }
100100
101101 if req. wants_json ( ) {
102- #[ derive( Serialize ) ]
103- struct R {
104- url : String ,
105- }
106- Ok ( req. json ( & R { url : redirect_url } ) )
102+ Ok ( req. json ( & json ! ( { "url" : redirect_url } ) ) )
107103 } else {
108104 Ok ( req. redirect ( redirect_url) )
109105 }
@@ -129,13 +125,7 @@ pub fn downloads(req: &mut dyn RequestExt) -> EndpointResult {
129125 . load ( & * conn) ?
130126 . into_iter ( )
131127 . map ( VersionDownload :: into)
132- . collect ( ) ;
128+ . collect :: < Vec < EncodableVersionDownload > > ( ) ;
133129
134- #[ derive( Serialize ) ]
135- struct R {
136- version_downloads : Vec < EncodableVersionDownload > ,
137- }
138- Ok ( req. json ( & R {
139- version_downloads : downloads,
140- } ) )
130+ Ok ( req. json ( & json ! ( { "version_downloads" : downloads } ) ) )
141131}
You can’t perform that action at this time.
0 commit comments