diff --git a/kv_v1.go b/kv_v1.go index 74bf890..01bc040 100644 --- a/kv_v1.go +++ b/kv_v1.go @@ -1,9 +1,5 @@ package vault -import ( - "net/url" -) - const ( pathPrefix string = "v1" ) @@ -30,7 +26,7 @@ func (k *KVv1) Create(id string, data map[string]string) error { []string{ pathPrefix, k.MountPoint, - url.PathEscape(id), + id, }, data, nil, nil, ) if err != nil { @@ -51,7 +47,7 @@ func (k *KVv1) Read(key string) (*KVv1ReadResponse, error) { []string{ pathPrefix, k.MountPoint, - url.PathEscape(key), + key, }, readRes, nil, ) if err != nil { @@ -74,7 +70,7 @@ func (k *KVv1) List(key string) (*KVv1ListResponse, error) { []string{ pathPrefix, k.MountPoint, - url.PathEscape(key), + key, }, nil, listRes, nil, ) if err != nil { @@ -89,7 +85,7 @@ func (k *KVv1) Delete(key string) error { []string{ pathPrefix, k.MountPoint, - url.PathEscape(key), + key, }, nil, nil, nil, ) if err != nil { diff --git a/kv_v1_test.go b/kv_v1_test.go index 9e62558..c2961a6 100644 --- a/kv_v1_test.go +++ b/kv_v1_test.go @@ -86,12 +86,19 @@ func (s *KVv1TestSuite) TestCreateAndList() { require.NoError(s.T(), s.client.Create("foo", testKeyValues)) require.NoError(s.T(), s.client.Create("foo2", testKeyValues)) + require.NoError(s.T(), s.client.Create("foo3/test", testKeyValues)) list, listErr := s.client.List("") require.NoError(s.T(), listErr) require.Contains(s.T(), list.Data.Keys, "foo") require.Contains(s.T(), list.Data.Keys, "foo2") - require.Len(s.T(), list.Data.Keys, 2) + require.Contains(s.T(), list.Data.Keys, "foo3/") + require.Len(s.T(), list.Data.Keys, 3) + nestedList, nestedListErr := s.client.List("foo3") + require.NoError(s.T(), nestedListErr) + + require.Contains(s.T(), nestedList.Data.Keys, "test") + require.Len(s.T(), nestedList.Data.Keys, 1) }