aboutsummaryrefslogtreecommitdiff
path: root/instance.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-12-01 19:45:55 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-12-01 19:45:55 +0100
commit12af3f2e8fad65534b83260967ea7463df6ca652 (patch)
tree97aab78be87e0c62bf6498011f8b041d859566c9 /instance.go
parent6cd12911f4d3aa4c6a75c922f9de231e2cf309dd (diff)
renamed and documented function
Diffstat (limited to 'instance.go')
-rw-r--r--instance.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/instance.go b/instance.go
index 55b23fc..2c108aa 100644
--- a/instance.go
+++ b/instance.go
@@ -28,10 +28,10 @@ const (
EndpointGetSth = Endpoint("get-sth")
)
-// Url builds an endpoint url from a number of components, e.g., base and prefix
-func (e Endpoint) Url(components ...string) string {
- components = append(components, string(e))
- return strings.Join(components, "/")
+// Path joins a number of components to form a full endpoint path, e.g., base
+// ("example.com"), prefix ("st/v1"), and the endpoint itself ("get-sth").
+func (e Endpoint) Path(components ...string) string {
+ return strings.Join(append(components, string(e)), "/")
}
// Instance is an instance of a particular log front-end
@@ -122,27 +122,27 @@ func (i *Instance) registerHandlers(mux *http.ServeMux) {
handler handler
}{
{
- EndpointAddEntry.Url("", i.LogParameters.Prefix),
+ EndpointAddEntry.Path("", i.LogParameters.Prefix),
handler{instance: i, handler: addEntry, endpoint: EndpointAddEntry, method: http.MethodPost},
},
{
- EndpointGetEntries.Url("", i.LogParameters.Prefix),
+ EndpointGetEntries.Path("", i.LogParameters.Prefix),
handler{instance: i, handler: getEntries, endpoint: EndpointGetEntries, method: http.MethodGet},
},
{
- EndpointGetAnchors.Url("", i.LogParameters.Prefix),
+ EndpointGetAnchors.Path("", i.LogParameters.Prefix),
handler{instance: i, handler: getAnchors, endpoint: EndpointGetAnchors, method: http.MethodGet},
},
{
- EndpointGetProofByHash.Url("", i.LogParameters.Prefix),
+ EndpointGetProofByHash.Path("", i.LogParameters.Prefix),
handler{instance: i, handler: getProofByHash, endpoint: EndpointGetProofByHash, method: http.MethodGet},
},
{
- EndpointGetConsistencyProof.Url("", i.LogParameters.Prefix),
+ EndpointGetConsistencyProof.Path("", i.LogParameters.Prefix),
handler{instance: i, handler: getConsistencyProof, endpoint: EndpointGetConsistencyProof, method: http.MethodGet},
},
{
- EndpointGetSth.Url("", i.LogParameters.Prefix),
+ EndpointGetSth.Path("", i.LogParameters.Prefix),
handler{instance: i, handler: getSth, endpoint: EndpointGetSth, method: http.MethodGet},
},
} {