@@ -36,7 +36,6 @@ super::function_definition_macro::sqlpage_functions! {
3636 version( ) ;
3737}
3838
39-
4039/// Returns the password from the HTTP basic auth header, if present.
4140async fn basic_auth_password ( request : & RequestInfo ) -> anyhow:: Result < & str > {
4241 let password = extract_basic_auth ( request) ?. password ( ) . ok_or_else ( || {
@@ -117,8 +116,9 @@ async fn exec<'a>(
117116 Ok ( String :: from_utf8_lossy ( & res. stdout ) . into_owned ( ) )
118117}
119118
120-
121- async fn fetch ( http_request : super :: http_fetch_request:: HttpFetchRequest < ' _ > ) -> anyhow:: Result < String > {
119+ async fn fetch (
120+ http_request : super :: http_fetch_request:: HttpFetchRequest < ' _ > ,
121+ ) -> anyhow:: Result < String > {
122122 use awc:: http:: Method ;
123123 let client = awc:: Client :: builder ( )
124124 . add_default_header ( ( awc:: http:: header:: USER_AGENT , env ! ( "CARGO_PKG_NAME" ) ) )
@@ -175,13 +175,11 @@ async fn header<'a>(request: &'a RequestInfo, name: Cow<'a, str>) -> Option<Cow<
175175 request. headers . get ( & * name) . map ( SingleOrVec :: as_json_str)
176176}
177177
178-
179178/// Returns the path component of the URL of the current request.
180179async fn path ( request : & RequestInfo ) -> & str {
181180 & request. path
182181}
183182
184-
185183const DEFAULT_ALLOWED_EXTENSIONS : & str =
186184 "jpg,jpeg,png,gif,bmp,webp,pdf,txt,doc,docx,xls,xlsx,csv,mp3,mp4,wav,avi,mov" ;
187185
@@ -259,14 +257,12 @@ pub(crate) fn random_string_sync(len: usize) -> String {
259257 . collect ( )
260258}
261259
262-
263260#[ tokio:: test]
264261async fn test_random_string ( ) {
265262 let s = random_string ( 10 ) . await . unwrap ( ) ;
266263 assert_eq ! ( s. len( ) , 10 ) ;
267264}
268265
269-
270266async fn read_file_bytes < ' a > (
271267 request : & ' a RequestInfo ,
272268 path_str : & str ,
@@ -287,7 +283,6 @@ async fn read_file_bytes<'a>(
287283 }
288284}
289285
290-
291286async fn read_file_as_data_url < ' a > (
292287 request : & ' a RequestInfo ,
293288 file_path : Option < Cow < ' a , str > > ,
@@ -393,7 +388,6 @@ async fn run_sql<'a>(
393388 Ok ( Some ( Cow :: Owned ( String :: from_utf8 ( json_results_bytes) ?) ) )
394389}
395390
396-
397391#[ tokio:: test]
398392async fn test_hash_password ( ) {
399393 let s = hash_password ( "password" . to_string ( ) ) . await . unwrap ( ) ;
@@ -420,7 +414,6 @@ async fn uploaded_file_path<'a>(
420414 Some ( uploaded_file. file . path ( ) . to_string_lossy ( ) )
421415}
422416
423-
424417/// escapes a string for use in a URL using percent encoding
425418/// for example, spaces are replaced with %20, '/' with %2F, etc.
426419/// This is useful for constructing URLs in SQL queries.
@@ -478,4 +471,4 @@ async fn variables<'a>(
478471/// Returns the version of the sqlpage that is running.
479472async fn version ( ) -> & ' static str {
480473 env ! ( "CARGO_PKG_VERSION" )
481- }
474+ }
0 commit comments