]> Cypherpunks repositories - gostls13.git/commit
net/http: add FS to convert fs.FS to FileSystem
authorRuss Cox <rsc@golang.org>
Tue, 7 Jul 2020 13:51:45 +0000 (09:51 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 20 Oct 2020 18:41:15 +0000 (18:41 +0000)
commit7211694a1e3f9eaebff7074944feead968e00e72
treec49b8d6eb5a6bc1cf766076fb00c61f897d9ec28
parent2a9aa4dcac0c33f7fffefb94a1bc92a17fd7cfd3
net/http: add FS to convert fs.FS to FileSystem

Two different functions in the http API expect a FileSystem:
http.FileSystem and http.NewFileTransport.
Add a general converter http.FS to turn an fs.FS into an http.FileSystem
for use with either of these functions.

(The original plan was to add http.HandlerFS taking an fs.FS directly,
but that doesn't help with NewFileTransport.)

For #41190.

Change-Id: I5f242eafe9b963f4387419a2615bdb487c358f16
Reviewed-on: https://go-review.googlesource.com/c/go/+/243939
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
src/net/http/fs.go
src/net/http/fs_test.go