mirror of
https://github.com/duke-git/lancet.git
synced 2026-11-16 05:12:11 +08:00
Apply remaining changes
Co-authored-by: duke-git <5037603+duke-git@users.noreply.github.com>
This commit is contained in:
1 parent
9903096704
commit
41a0f309dd
4 files changed
+79
-64
No files matched your search
+10
-2
@@ -1,7 +1,10 @@
|
||||
package fileutil
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -516,9 +519,14 @@ func TestWriteBytesToFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestReadFile(t *testing.T) {
|
||||
reader, close, err := ReadFile("https://httpbin.org/robots.txt")
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprint(w, "User-agent: *\nDisallow: /deny\n")
|
||||
}))
|
||||
defer ts.Close()
|
||||
|
||||
reader, close, err := ReadFile(ts.URL)
|
||||
if err != nil {
|
||||
t.Fail()
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer close()
|
||||
|
||||
|
||||
Reference in new issue
Block a user