diff --git a/core/corehttp/corehttp.go b/core/corehttp/corehttp.go index e8852baaf59..75feb930e26 100644 --- a/core/corehttp/corehttp.go +++ b/core/corehttp/corehttp.go @@ -23,9 +23,9 @@ var log = eventlog.Logger("core/server") // initially passed in if not. type ServeOption func(*core.IpfsNode, *http.ServeMux) (*http.ServeMux, error) -// makeHandler turns a list of ServeOptions into a http.Handler that implements +// MakeHandler turns a list of ServeOptions into a http.Handler that implements // all of the given options, in order. -func makeHandler(n *core.IpfsNode, options ...ServeOption) (http.Handler, error) { +func MakeHandler(n *core.IpfsNode, options ...ServeOption) (http.Handler, error) { topMux := http.NewServeMux() mux := topMux for _, option := range options { @@ -49,7 +49,7 @@ func ListenAndServe(n *core.IpfsNode, listeningMultiAddr string, options ...Serv if err != nil { return err } - handler, err := makeHandler(n, options...) + handler, err := MakeHandler(n, options...) if err != nil { return err } diff --git a/core/corehttp/gateway_test.go b/core/corehttp/gateway_test.go index ab822a95916..6890d4ede34 100644 --- a/core/corehttp/gateway_test.go +++ b/core/corehttp/gateway_test.go @@ -1,4 +1,4 @@ -package corehttp +package corehttp_test import ( "errors" @@ -10,13 +10,13 @@ import ( context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context" core "github.com/ipfs/go-ipfs/core" - importer "github.com/ipfs/go-ipfs/importer" - chunk "github.com/ipfs/go-ipfs/importer/chunk" + corehttp "github.com/ipfs/go-ipfs/core/corehttp" namesys "github.com/ipfs/go-ipfs/namesys" ci "github.com/ipfs/go-ipfs/p2p/crypto" path "github.com/ipfs/go-ipfs/path" repo "github.com/ipfs/go-ipfs/repo" config "github.com/ipfs/go-ipfs/repo/config" + unixfs "github.com/ipfs/go-ipfs/shell/unixfs" testutil "github.com/ipfs/go-ipfs/util/testutil" ) @@ -61,11 +61,7 @@ func TestGatewayGet(t *testing.T) { t.Skip("not sure whats going on here") ns := mockNamesys{} n := newNodeWithMockNamesys(t, ns) - dagNode, err := importer.BuildDagFromReader( - strings.NewReader("fnord"), - n.DAG, - n.Pinning.GetManual(), - chunk.DefaultSplitter) + dagNode, err := unixfs.AddFromReader(n, strings.NewReader("fnord")) if err != nil { t.Fatal(err) } @@ -76,9 +72,9 @@ func TestGatewayGet(t *testing.T) { k := key.String() ns["example.com"] = path.FromString("/ipfs/" + k) - h, err := makeHandler(n, - IPNSHostnameOption(), - GatewayOption(false), + h, err := corehttp.MakeHandler(n, + corehttp.IPNSHostnameOption(), + corehttp.GatewayOption(false), ) if err != nil { t.Fatal(err)