Skip to content

http.Client ignores Transport #30

@adamreese

Description

@adamreese

Hi friends!

I'm trying to use a custom Transport on a http.Client but the RoundTrip is never called. It worked as expected prior to v0.29.

Here's an example:

type Transport struct{}

func (r *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
	fmt.Println("never called")
	return nil, nil
}

func doIt() {
	client := &http.Client{
		Transport: &Transport{},
	}
	req, _ := http.NewRequest(http.MethodGet, "https://random-data-api.fermyon.app/animals/json", nil)
	client.Do(req)
}

Thanks for the great work on this project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions