1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 01:52:26 +08:00

get rid of fmt dependency in http

This commit is contained in:
verokarhu
2014-08-06 20:31:01 +03:00
parent 356ee0383f
commit a82f814b06

View File

@ -1,7 +1,6 @@
package http
import (
"fmt"
"github.com/gorilla/mux"
core "github.com/jbenet/go-ipfs/core"
"github.com/jbenet/go-ipfs/importer"
@ -32,11 +31,10 @@ func (i *ipfsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
fmt.Fprintf(w, "%s", nd.Data)
w.Write(nd.Data)
}
func ipfsPostHandler(w http.ResponseWriter, r *http.Request, node *core.IpfsNode) {
root, err := importer.NewDagFromReader(r.Body, 1)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
@ -51,5 +49,5 @@ func ipfsPostHandler(w http.ResponseWriter, r *http.Request, node *core.IpfsNode
//TODO: return json representation of list instead
w.WriteHeader(http.StatusCreated)
fmt.Fprintf(w, "%s", mh.Multihash(k).B58String())
w.Write([]byte(mh.Multihash(k).B58String()))
}