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:
committed by
Nick Craig-Wood
parent
77221d7528
commit
5d2e327b6f
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user