Browse Source

fix hmm... another stupid mistake

Xiang Li 12 years ago
parent
commit
4479d72e93
1 changed files with 2 additions and 1 deletions
  1. 2 1
      server/v1/set_key_handler.go

+ 2 - 1
server/v1/set_key_handler.go

@@ -1,6 +1,7 @@
 package v1
 
 import (
+	"fmt"
 	"net/http"
 
 	etcdErr "github.com/coreos/etcd/error"
@@ -31,7 +32,7 @@ func SetKeyHandler(w http.ResponseWriter, req *http.Request, s Server) error {
 	// If the "prevValue" is specified then test-and-set. Otherwise create a new key.
 	var c raft.Command
 	if prevValueArr, ok := req.Form["prevValue"]; ok {
-		if len(prevValueArr) > 0 { // test against previous value
+		if len(prevValueArr[0]) > 0 { // test against previous value
 			c = &store.CompareAndSwapCommand{
 				Key:        key,
 				Value:      value,