-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Proxy server header capability #628
feat: Proxy server header capability #628
Conversation
…tance creation for ProxyServerConfig & ServerURL
optOutTrackingByDefault: Bool = false, | ||
useUniqueDistinctId: Bool = false, | ||
superProperties: Properties? = nil, | ||
proxyServerConfig: ProxyServerConfig) -> MixpanelInstance { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if proxyServerConfig
is optional, could you add proxyServerConfig: ProxyServerConfig? = nil
to the existing initialize
function rather than adding a new function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback on the PR 🙌 . On using the same intialize
function, they are few points I want to highlight.
- By combining
serverURL
andProxyServerConfig
into one method, we risk users setting both parameters, which doesn't align with their intended use. Ideally one of them should be set. Keeping them separate ensures users have a clear choice without the possibility of configuring conflicting options. - With two distinct initialization methods, we're directly guiding users on their options. One method is for basic server URL configuration, and the other is for more advanced proxy configurations.
thank you so much @mohitanand-cred ! the PR looks good except one comment, also could you rebase/merge from the latest master and make sure all CI tests pass? |
…nto feat/proxy_server_header_capability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes:
header
andquery items
parameter.ProxyServerConfig
which takes in proxy server url and a delegate(MixpanelProxyServerDelegate
).MixpanelProxyServerDelegate
can be used to provide headers or query items to the proxy server. The delegate funcmixpanelResourceForProxyServer(_ mixpanel: MixpanelInstance) -> ServerProxyResource?
is being called when its time flush the batch request.initialize
function in Mixpanel which takes inProxyServerConfig
instead of justserverURL
.