Skip to content

Replace explicit http.Client usage with specific interface - #18

Open
egor-gorlin-exinity wants to merge 3 commits into
mParticle:masterfrom
egor-gorlin-exinity:master
Open

Replace explicit http.Client usage with specific interface#18
egor-gorlin-exinity wants to merge 3 commits into
mParticle:masterfrom
egor-gorlin-exinity:master

Conversation

@egor-gorlin-exinity

Copy link
Copy Markdown

Summary

This PR replaces explicit http.Client usage with narrow and specific interface.

We need to have ability to intercept outgoing http requests to perform verbose logging.
To achieve that we wrap http.Client with our implementation which passes requests through and logs them.

Also fixes typo in unit tests.

Testing Plan

You should be able to replace Configuration.HTTPClient with your own implmentation of RequestDoer interface.

Master Issue

Closes #17

Comment thread events/configuration.go
APISecret string `json:"apiSecret,omitempty"`
}

type RequestDoer interface {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type RequestDoer interface {
type HTTPDoer interface {

I would recommend naming specific to HTTP since the interface is just in the events package. This will help the developers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to use own implementation of http client

2 participants