Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Commit

Permalink
Removed sending message after Pin and UNpin API
Browse files Browse the repository at this point in the history
  • Loading branch information
jmozah committed Aug 9, 2019
1 parent 055ed27 commit 9cd0ca5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
2 changes: 0 additions & 2 deletions api/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,6 @@ func (s *Server) HandlePin(w http.ResponseWriter, r *http.Request) {
log.Debug("pinned content", "ruid", ruid, "key", fileAddr.Hex())
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
fmt.Fprint(w, fmt.Sprintf("Address %s pinned", fileAddr.Hex()))
}

// HandleUnpin takes a root hash as argument and unpins the file or collection from the local Swarm DB
Expand All @@ -973,7 +972,6 @@ func (s *Server) HandleUnpin(w http.ResponseWriter, r *http.Request) {
log.Debug("unpinned content", "ruid", ruid, "key", fileAddr.Hex())
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
fmt.Fprint(w, fmt.Sprintf("Address %s unpinned", fileAddr.Hex()))
}

// HandleGetPins return information about all the hashes pinned at this moment
Expand Down
16 changes: 2 additions & 14 deletions api/http/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,7 @@ func TestPinUnpinAPI(t *testing.T) {
rootHash := uploadFile(t, srv, data)

// pin it
pinMessage := pinFile(t, srv, rootHash)

// Check if the return message is valid
expectedPinMsg := fmt.Sprintf("Address %s pinned", string(rootHash))
if string(pinMessage) != expectedPinMsg {
t.Fatalf("pin message mismatch, expected %x, got %x", expectedPinMsg, pinMessage)
}
pinFile(t, srv, rootHash)

// get the list of files pinned
pinnedInfo := listPinnedFiles(t, srv)
Expand All @@ -117,13 +111,7 @@ func TestPinUnpinAPI(t *testing.T) {
}

// unpin it
unpinMessage := unpinFile(t, srv, rootHash)

// Check if the return message is valid
expectedunPinMsg := fmt.Sprintf("Address %s unpinned", string(rootHash))
if string(unpinMessage) != expectedunPinMsg {
t.Fatalf("pin message mismatch, expected %x, got %x", expectedunPinMsg, unpinMessage)
}
unpinFile(t, srv, rootHash)

// get the list of files pinned again
unpinnedInfo := listPinnedFiles(t, srv)
Expand Down

0 comments on commit 9cd0ca5

Please sign in to comment.