Skip to content

Commit c68e472

Browse files
authored
updates for v4 TT compatability (#59)
* updates for v4 TT compatability * add v4 post app identifier endpoint * remove v4 app identifier visitor configs endpoint * remove unused api v1 endpoint from fake server * bump version
1 parent 48302ef commit c68e472

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SHELL = /bin/sh
22

3-
VERSION=1.2.0
3+
VERSION=1.3.0
44
BUILD=`git rev-parse HEAD`
55

66
LDFLAGS=-ldflags "-w -s \

fakeserver/routes.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ func (s *server) routes() {
139139
"/api/v1/identifier",
140140
postV1Identifier,
141141
)
142+
s.handlePost(
143+
"/api/v4/apps/{a}/versions/{v}/builds/{b}/identifier",
144+
postV4AppIdentifier,
145+
)
142146
s.handleGet(
143147
"/api/v1/visitors/{id}",
144148
getV1Visitor,
@@ -167,14 +171,6 @@ func (s *server) routes() {
167171
"/api/v4/apps/{a}/versions/{v}/builds/{b}/visitors/{id}/config",
168172
getV4AppVisitorConfig,
169173
)
170-
s.handleGet(
171-
"/api/v1/apps/{a}/versions/{v}/builds/{b}/identifier_types/{t}/identifiers/{i}/visitor_config",
172-
getV1AppVisitorConfig,
173-
)
174-
s.handleGet(
175-
"/api/v4/apps/{a}/versions/{v}/builds/{b}/identifier_types/{t}/identifiers/{i}/visitor_config",
176-
getV4AppVisitorConfig,
177-
)
178174
s.handleGet(
179175
"/api/v1/split_details/{id}",
180176
getV1SplitDetail,
@@ -271,6 +267,10 @@ func postV1Identifier(*http.Request) (interface{}, error) {
271267
return map[string]v1Visitor{"visitor": visitor}, nil
272268
}
273269

270+
func postV4AppIdentifier(*http.Request) (interface{}, error) {
271+
return getV4AppVisitorConfig()
272+
}
273+
274274
func getV1Visitor() (interface{}, error) {
275275
assignments, err := fakeassignments.Read()
276276
if err != nil {

fakeserver/server_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,16 @@ func TestVisitorConfig(t *testing.T) {
151151
})
152152
}
153153

154-
func TestIdentifierVisitorConfig(t *testing.T) {
154+
func TestAppIdentifier(t *testing.T) {
155155
t.Run("it loads visitor config v4", func(t *testing.T) {
156156
w := httptest.NewRecorder()
157157
h := createHandler()
158158

159-
h.ServeHTTP(w, httptest.NewRequest("GET", "/api/v4/apps/foo/versions/1/builds/2020-01-02T03:04:05/identifier_types/user_id/identifiers/123/visitor_config", nil))
159+
request := httptest.NewRequest("POST", "/api/v4/apps/foo/versions/1/builds/2020-01-02T03:04:05/identifier", nil)
160+
request.Header.Add("Content-Type", "application/json")
161+
request.Header.Add("Content-Length", "0")
162+
163+
h.ServeHTTP(w, request)
160164

161165
require.Equal(t, http.StatusOK, w.Code)
162166

0 commit comments

Comments
 (0)