Giter VIP home page Giter VIP logo

Comments (4)

alexkappa avatar alexkappa commented on June 12, 2024

Hi @starsz, I find the proposal to adopt interfaces reasonable and your use case valid. Its a large undertaking however and a potentially backwards incompatible change (so a major version bump may be warranted).

Just to make sure you have explored the option, did you try to pass your own implementation of http.Client? Its not exactly the same, but you can mock the HTTP layer by providing a custom client.

from auth0.

emmaLP avatar emmaLP commented on June 12, 2024

@alexkappa do you have an example where injecting a mock http client has been done for auth0 when unit testing?

from auth0.

mutefiRe avatar mutefiRe commented on June 12, 2024

Just to make sure you have explored the option, did you try to pass your own implementation of http.Client? Its not exactly the same, but you can mock the HTTP layer by providing a custom client.

func WithClient(client *http.Client) ManagementOption {
	return func(m *Management) {
		m.http = client
	}
}

You can't pass an own implementation of http.Client either because the function uses the http.Client struct type instead of an interface around the Do method. Is there any other way to inject it?

from auth0.

sergiught avatar sergiught commented on June 12, 2024

Closed and cloned this issue to auth0/go-auth0#17

from auth0.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.