1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

http: Replace httplib with lib/http

This commit is contained in:
Nolan Woods
2021-04-19 22:14:21 -07:00
committed by Nick Craig-Wood
parent 77221d7528
commit 5d2e327b6f
4 changed files with 54 additions and 46 deletions

View File

@@ -10,10 +10,10 @@ import (
"time"
_ "github.com/rclone/rclone/backend/local"
"github.com/rclone/rclone/cmd/serve/httplib"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/config/configfile"
"github.com/rclone/rclone/fs/filter"
httplib "github.com/rclone/rclone/lib/http"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -32,10 +32,13 @@ const (
func startServer(t *testing.T, f fs.Fs) {
opt := httplib.DefaultOpt
opt.ListenAddr = testBindAddress
opt.Template = testTemplate
httpServer = newServer(f, &opt)
assert.NoError(t, httpServer.Serve())
testURL = httpServer.Server.URL()
httpServer = newServer(f, testTemplate)
router, err := httplib.Router()
if err != nil {
t.Fatal(err.Error())
}
httpServer.Bind("/*", router)
testURL = httplib.URL()
// try to connect to the test server
pause := time.Millisecond
@@ -227,6 +230,5 @@ func TestGET(t *testing.T) {
}
func TestFinalise(t *testing.T) {
httpServer.Close()
httpServer.Wait()
_ = httplib.Shutdown()
}