Skip to content

Commit

Permalink
gateway: use core api for serving POST requests
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
  • Loading branch information
Lars Gierth committed Nov 7, 2016
1 parent c31e4f7 commit 0097b42
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions core/corehttp/gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (i *gatewayHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if i.config.Writable {
switch r.Method {
case "POST":
i.postHandler(w, r)
i.postHandler(ctx, w, r)
return
case "PUT":
i.putHandler(w, r)
Expand Down Expand Up @@ -314,14 +314,8 @@ func (i *gatewayHandler) getOrHeadHandler(ctx context.Context, w http.ResponseWr
}
}

func (i *gatewayHandler) postHandler(w http.ResponseWriter, r *http.Request) {
nd, err := i.newDagFromReader(r.Body)
if err != nil {
internalWebError(w, err)
return
}

k, err := i.node.DAG.Add(nd)
func (i *gatewayHandler) postHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) {
k, err := i.api.Add(ctx, r.Body)
if err != nil {
internalWebError(w, err)
return
Expand Down

0 comments on commit 0097b42

Please sign in to comment.