diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-08-30 09:47:45 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-08-30 09:47:45 +0200 |
commit | cfc023e6f0235a9c5d272175cd4a2d72fe368c5f (patch) | |
tree | 76d63272be1a1d51b6ad4ffccdfcb0d8e264fd59 /client | |
parent | 0cb34bea93a4090af9eacb98529a3157dc89ece7 (diff) |
idToUrlPath -> idToURLPath
Diffstat (limited to 'client')
-rw-r--r-- | client/go/cmd/document.go | 2 | ||||
-rw-r--r-- | client/go/cmd/document_test.go | 2 | ||||
-rw-r--r-- | client/go/vespa/id.go | 2 | ||||
-rw-r--r-- | client/go/vespa/id_test.go | 12 |
4 files changed, 9 insertions, 9 deletions
diff --git a/client/go/cmd/document.go b/client/go/cmd/document.go index 48b300db964..38e7cc9bc0e 100644 --- a/client/go/cmd/document.go +++ b/client/go/cmd/document.go @@ -90,7 +90,7 @@ func post(documentId string, jsonFile string) { } } - documentPath, documentPathError := vespa.IdToUrlPath(documentId) + documentPath, documentPathError := vespa.IdToURLPath(documentId) if documentPathError != nil { log.Print("Invalid document id '", color.Red(documentId), "': ", documentPathError) return diff --git a/client/go/cmd/document_test.go b/client/go/cmd/document_test.go index 789747e989d..4e3cccfdb26 100644 --- a/client/go/cmd/document_test.go +++ b/client/go/cmd/document_test.go @@ -56,7 +56,7 @@ func assertDocumentPost(arguments []string, documentId string, jsonFile string, documentId+"\n", executeCommand(t, client, arguments, []string{})) target := getTarget(documentContext).document - expectedPath, _ := vespa.IdToUrlPath(documentId) + expectedPath, _ := vespa.IdToURLPath(documentId) assert.Equal(t, target+"/document/v1/"+expectedPath, client.lastRequest.URL.String()) assert.Equal(t, "application/json", client.lastRequest.Header.Get("Content-Type")) assert.Equal(t, "POST", client.lastRequest.Method) diff --git a/client/go/vespa/id.go b/client/go/vespa/id.go index 70570188d93..ad6e289586e 100644 --- a/client/go/vespa/id.go +++ b/client/go/vespa/id.go @@ -9,7 +9,7 @@ import ( "strings" ) -func IdToUrlPath(documentId string) (string, error) { +func IdToURLPath(documentId string) (string, error) { parts := strings.Split(documentId, ":") formatAdvice := "Id should be on the form id:<namespace>:<document-type>:<attribute>?:<local-id-string>" if len(parts) < 5 { diff --git a/client/go/vespa/id_test.go b/client/go/vespa/id_test.go index 2e4a9a80dd9..61183465186 100644 --- a/client/go/vespa/id_test.go +++ b/client/go/vespa/id_test.go @@ -6,14 +6,14 @@ import ( "github.com/stretchr/testify/assert" ) -func TestIdToUrlPath(t *testing.T) { - assertIdToUrlPath("ns/type/docid/local", "id:ns:type::local", t) - assertIdToUrlPath("ns/type/number/123/docid/local", "id:ns:type:n=123:local", t) - assertIdToUrlPath("ns/type/group/mygroup/docid/local", "id:ns:type:g=mygroup:local", t) +func TestIdToURLPath(t *testing.T) { + assertIdToURLPath("ns/type/docid/local", "id:ns:type::local", t) + assertIdToURLPath("ns/type/number/123/docid/local", "id:ns:type:n=123:local", t) + assertIdToURLPath("ns/type/group/mygroup/docid/local", "id:ns:type:g=mygroup:local", t) } -func assertIdToUrlPath(expectedPath string, id string, t *testing.T) { - path, err := IdToUrlPath(id) +func assertIdToURLPath(expectedPath string, id string, t *testing.T) { + path, err := IdToURLPath(id) assert.Nil(t, err) assert.Equal(t, expectedPath, path) } |