File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -479,10 +479,14 @@ module Http =
479
479
else raise <| Exception( " File canonalization issue." )
480
480
else raise <| Exception( " File canonalization issue." )
481
481
482
- let browse_file file_name =
482
+ let browse_file root_path file_name =
483
483
fun ({ request = r ; runtime = q } as h ) ->
484
- file ( local_ file file_ name q.home _ directory ) h
484
+ file ( local_ file file_ name root _ path ) h
485
485
486
+ let browse_file ' file_name =
487
+ fun ({ request = r ; runtime = q } as h ) ->
488
+ browse_ file q.home_ directory file_ name h
489
+
486
490
let browse root_path : WebPart =
487
491
warbler ( fun { request = r ; runtime = { logger = l } } ->
488
492
Log.verbose l
Original file line number Diff line number Diff line change @@ -1343,12 +1343,19 @@ module Http =
1343
1343
/// </remarks>
1344
1344
val local_file : file_name : string -> root_path : string -> string
1345
1345
1346
+ /// <summary><para>
1347
+ /// 'browse' the file given as the filename, by sending it to the browser with a
1348
+ /// MIME-type/Content-Type header based on its extension. Will service from the
1349
+ /// root_path.
1350
+ /// </para></summary>
1351
+ val browse_file : root_path : string -> file_name : string -> WebPart
1352
+
1346
1353
/// <summary><para>
1347
1354
/// 'browse' the file given as the filename, by sending it to the browser with a
1348
1355
/// MIME-type/Content-Type header based on its extension. Will service from the
1349
1356
/// current directory.
1350
1357
/// </para></summary>
1351
- val browse_file : file_name : string -> WebPart
1358
+ val browse_file ' : file_name : string -> WebPart
1352
1359
1353
1360
/// <summary><para>
1354
1361
/// 'browse' the file in the sense that the contents of the file are sent based on the
Original file line number Diff line number Diff line change @@ -36,10 +36,10 @@ let compression =
36
36
testCase " verifiying we get the same size uncompressed" <| fun _ ->
37
37
Assert.Equal( " length should match"
38
38
, test_ file_ size
39
- , ( run_ with' ( Files.browse_ file " test-text-file.txt" ) |> req_ bytes GET " /" None) .Length |> int64)
39
+ , ( run_ with' ( Files.browse_ file' " test-text-file.txt" ) |> req_ bytes GET " /" None) .Length |> int64)
40
40
41
41
testCase " gzip static file" <| fun _ ->
42
42
Assert.Equal( " length should match"
43
43
, test_ file_ size
44
- , ( run_ with' ( Files.browse_ file " test-text-file.txt" ) |> req_ gzip_ bytes GET " /" None) .Length |> int64)
44
+ , ( run_ with' ( Files.browse_ file' " test-text-file.txt" ) |> req_ gzip_ bytes GET " /" None) .Length |> int64)
45
45
]
You can’t perform that action at this time.
0 commit comments