Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeny.iva committed Aug 25, 2024
1 parent 51a7f5c commit 46fabd4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions feature_flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion posthog.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions posthog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}))
Expand Down Expand Up @@ -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)
}
}))
Expand Down Expand Up @@ -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")
}
}))
Expand Down Expand Up @@ -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")
}
}))
Expand Down Expand Up @@ -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")
}
}))
Expand Down

0 comments on commit 46fabd4

Please sign in to comment.