From fb39e96862b7565d587da506a210fbdb36555be2 Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Tue, 30 Aug 2016 10:50:25 -0700 Subject: [PATCH] client: change to 'NoValueOnSuccess' --- client/keys.generated.go | 3 ++- client/keys.go | 30 +++++++++++++++--------------- client/keys_test.go | 8 ++++---- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/client/keys.generated.go b/client/keys.generated.go index 748283aa9..16f10301a 100644 --- a/client/keys.generated.go +++ b/client/keys.generated.go @@ -8,10 +8,11 @@ package client import ( "errors" "fmt" - codec1978 "github.com/ugorji/go/codec" "reflect" "runtime" time "time" + + codec1978 "github.com/ugorji/go/codec" ) const ( diff --git a/client/keys.go b/client/keys.go index fb24affbd..b74b9e0a5 100644 --- a/client/keys.go +++ b/client/keys.go @@ -192,9 +192,9 @@ type SetOptions struct { // Dir specifies whether or not this Node should be created as a directory. Dir bool - // NoDataOnSuccess specifies whether the response contains the current value of the Node. + // NoValueOnSuccess specifies whether the response contains the current value of the Node. // If set, the response will only contain the current value when the request fails. - NoDataOnSuccess bool + NoValueOnSuccess bool } type GetOptions struct { @@ -339,7 +339,7 @@ func (k *httpKeysAPI) Set(ctx context.Context, key, val string, opts *SetOptions act.TTL = opts.TTL act.Refresh = opts.Refresh act.Dir = opts.Dir - act.NoDataOnSuccess = opts.NoDataOnSuccess + act.NoValueOnSuccess = opts.NoValueOnSuccess } doCtx := ctx @@ -528,16 +528,16 @@ func (w *waitAction) HTTPRequest(ep url.URL) *http.Request { } type setAction struct { - Prefix string - Key string - Value string - PrevValue string - PrevIndex uint64 - PrevExist PrevExistType - TTL time.Duration - Refresh bool - Dir bool - NoDataOnSuccess bool + Prefix string + Key string + Value string + PrevValue string + PrevIndex uint64 + PrevExist PrevExistType + TTL time.Duration + Refresh bool + Dir bool + NoValueOnSuccess bool } func (a *setAction) HTTPRequest(ep url.URL) *http.Request { @@ -571,8 +571,8 @@ func (a *setAction) HTTPRequest(ep url.URL) *http.Request { if a.Refresh { form.Add("refresh", "true") } - if a.NoDataOnSuccess { - params.Set("noDataOnSuccess", strconv.FormatBool(a.NoDataOnSuccess)) + if a.NoValueOnSuccess { + params.Set("noValueOnSuccess", strconv.FormatBool(a.NoValueOnSuccess)) } u.RawQuery = params.Encode() diff --git a/client/keys_test.go b/client/keys_test.go index e7d0ceca1..2a59f32a9 100644 --- a/client/keys_test.go +++ b/client/keys_test.go @@ -407,13 +407,13 @@ func TestSetAction(t *testing.T) { wantURL: "http://example.com/foo?dir=true", wantBody: "", }, - // DataOnFailure is set + // NoValueOnSuccess is set { act: setAction{ - Key: "foo", - NoDataOnSuccess: true, + Key: "foo", + NoValueOnSuccess: true, }, - wantURL: "http://example.com/foo?noDataOnSuccess=true", + wantURL: "http://example.com/foo?noValueOnSuccess=true", wantBody: "value=", }, }