diff --git a/feature_flags_test.go b/feature_flags_test.go index a55320d..3f19ca1 100644 --- a/feature_flags_test.go +++ b/feature_flags_test.go @@ -332,7 +332,7 @@ func TestFlagGroup(t *testing.T) { w.Write([]byte(fixture("test-decide-v3.json"))) } else if strings.HasPrefix(r.URL.Path, "/api/feature_flag/local_evaluation") { w.Write([]byte(fixture("feature_flag/test-flag-group-properties.json"))) - } else if strings.HasPrefix(r.URL.Path, "/batch/") { + } else if strings.HasPrefix(r.URL.Path, "/capture/") { // Ignore batch requests } else { t.Error("Unknown request made by library") @@ -4436,7 +4436,7 @@ func TestFlagWithTimeoutExceeded(t *testing.T) { w.Write([]byte(fixture("test-decide-v3.json"))) } else if strings.HasPrefix(r.URL.Path, "/api/feature_flag/local_evaluation") { w.Write([]byte(fixture("feature_flag/test-flag-group-properties.json"))) - } else if strings.HasPrefix(r.URL.Path, "/batch/") { + } else if strings.HasPrefix(r.URL.Path, "/capture/") { // Ignore batch requests } else { t.Error("Unknown request made by library") @@ -4538,7 +4538,7 @@ func TestFlagDefinitionsWithTimeoutExceeded(t *testing.T) { } else if strings.HasPrefix(r.URL.Path, "/api/feature_flag/local_evaluation") { time.Sleep(11 * time.Second) w.Write([]byte(fixture("feature_flag/test-flag-group-properties.json"))) - } else if strings.HasPrefix(r.URL.Path, "/batch/") { + } else if strings.HasPrefix(r.URL.Path, "/capture/") { // Ignore batch requests } else { t.Error("Unknown request made by library") diff --git a/message.go b/message.go index 2edd4ed..7f00a97 100644 --- a/message.go +++ b/message.go @@ -51,7 +51,7 @@ func makeTimestamp(t time.Time, def time.Time) time.Time { return t } -// This structure represents objects sent to the /batch/ endpoint. We don't +// This structure represents objects sent to the /capture/ endpoint. We don't // export this type because it's only meant to be used internally to send groups // of messages in one API call. type batch struct { diff --git a/posthog.go b/posthog.go index d6ffcfd..72925d7 100644 --- a/posthog.go +++ b/posthog.go @@ -462,7 +462,7 @@ func (c *client) send(msgs []message) { // Upload serialized batch message. func (c *client) upload(b []byte) error { - url := c.Endpoint + "/batch/" + url := c.Endpoint + "/capture/" req, err := http.NewRequest("POST", url, bytes.NewReader(b)) if err != nil { c.Errorf("creating request - %s", err) diff --git a/posthog_test.go b/posthog_test.go index e36e619..49b60d4 100644 --- a/posthog_test.go +++ b/posthog_test.go @@ -911,7 +911,7 @@ func TestGetFeatureFlagPayloadWithNoPersonalApiKey(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if strings.HasPrefix(r.URL.Path, "/decide") { w.Write([]byte(fixture("test-decide-v3.json"))) - } else if !strings.HasPrefix(r.URL.Path, "/batch") { + } else if !strings.HasPrefix(r.URL.Path, "/capture") { t.Errorf("client called an endpoint it shouldn't have: %s", r.URL.Path) } })) @@ -1097,7 +1097,7 @@ func TestGetFeatureFlagWithNoPersonalApiKey(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if strings.HasPrefix(r.URL.Path, "/decide") { w.Write([]byte(fixture("test-decide-v3.json"))) - } else if !strings.HasPrefix(r.URL.Path, "/batch") { + } else if !strings.HasPrefix(r.URL.Path, "/capture") { t.Errorf("client called an endpoint it shouldn't have: %s", r.URL.Path) } })) @@ -1543,7 +1543,7 @@ func TestComplexFlag(t *testing.T) { w.Write([]byte(fixture("test-decide-v3.json"))) } else if strings.HasPrefix(r.URL.Path, "/api/feature_flag/local_evaluation") { w.Write([]byte(fixture("test-api-feature-flag.json"))) - } else if !strings.HasPrefix(r.URL.Path, "/batch") { + } else if !strings.HasPrefix(r.URL.Path, "/capture") { t.Errorf("client called an endpoint it shouldn't have") } })) @@ -1595,7 +1595,7 @@ func TestMultiVariateFlag(t *testing.T) { w.Write([]byte(fixture("test-decide-v3.json"))) } else if strings.HasPrefix(r.URL.Path, "/api/feature_flag/local_evaluation") { w.Write([]byte("{}")) - } else if !strings.HasPrefix(r.URL.Path, "/batch") { + } else if !strings.HasPrefix(r.URL.Path, "/capture") { t.Errorf("client called an endpoint it shouldn't have") } })) @@ -1647,7 +1647,7 @@ func TestDisabledFlag(t *testing.T) { w.Write([]byte(fixture("test-decide-v3.json"))) } else if strings.HasPrefix(r.URL.Path, "/api/feature_flag/local_evaluation") { w.Write([]byte("{}")) - } else if !strings.HasPrefix(r.URL.Path, "/batch") { + } else if !strings.HasPrefix(r.URL.Path, "/capture") { t.Errorf("client called an endpoint it shouldn't have") } }))