get rid of fmt dependency in http
verokarhu committed
Aug 6, 2014 at 20:31 UTC
a82f814b0674f0bff889c07a98da1b6a0b00bfc9
1 file changed
+2
-4
http/http.go
+2
-4
@@ -1,7 +1,6 @@
1
package http
2
3
import (
4
- "fmt"
4
"github.com/gorilla/mux"
5
core "github.com/jbenet/go-ipfs/core"
6
"github.com/jbenet/go-ipfs/importer"
@@ -32,11 +31,10 @@ func (i *ipfsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
31
return
32
}
33
35
- fmt.Fprintf(w, "%s", nd.Data)
34
+ w.Write(nd.Data)
35
}
36
37
func ipfsPostHandler(w http.ResponseWriter, r *http.Request, node *core.IpfsNode) {
39
-
38
root, err := importer.NewDagFromReader(r.Body, 1)
39
if err != nil {
40
w.WriteHeader(http.StatusInternalServerError)
@@ -51,5 +49,5 @@ func ipfsPostHandler(w http.ResponseWriter, r *http.Request, node *core.IpfsNode
49
50
//TODO: return json representation of list instead
51
w.WriteHeader(http.StatusCreated)
54
- fmt.Fprintf(w, "%s", mh.Multihash(k).B58String())
52
+ w.Write([]byte(mh.Multihash(k).B58String()))
53
}