mixpanel/mixpanel-android

Please add trailing slashes to request endpoints in the Android SDK.

elliottj-accolade opened this issue · 1 comments

Background: We implemented a proxy service to route our mixpanel calls through using next JS. We found out while using the Mixpanel JS SDK, the client did not receive a response back due to a 308: Permanent Redirect, and because NextJS requires us to specify whether or not we allow trailing slashes, we did not get a response back after the redirect.

The problem: So we added support for trailing slashes to our next.config.js. However, when we did that, the Android library stopped being able to send events to Mixpanel.

After digging around on Github, we found that other Mixpanel libraries have trailing slashes that terminate the request endpoints for track, engage, and groups:
iOS:

enum FlushType: String {
    case events = "/track/"
    case people = "/engage/"
    case groups = "/groups/"
}

JS

...                
events: batcher_for({type: 'events', endpoint: '/track/', queue_suffix: '_ev'}),               
people: batcher_for({type: 'people', endpoint: '/engage/', queue_suffix: '_pp'}),
groups: batcher_for({type: 'groups', endpoint: '/groups/', queue_suffix: '_gr'})

Android does not:

public static final String EVENT = "/track";
public static final String PEOPLE = "/engage";
public static final String GROUPS = "/groups";

We could probably write a workaround for this on the proxy level, but it may be a better solution for Mixpanel's routing to be consistent.

hi @elliottj-accolade , the fix has been included in v5.9.5. Thanks!