bogdanfinn / tls-client

net/http.Client like HTTP Client with options to select specific client TLS Fingerprints to use for requests.
BSD 4-Clause "Original" or "Old" License
668 stars 133 forks source link

Fixed Custom Redirect being used regardless if followRedirect is false #69

Closed ghost closed 11 months ago

ghost commented 11 months ago

In net/http, when defining a redirect function whether to follow or disable redirects, you must always define a custom function in the transport. Using the custom redirect func in the clientConfig, it causes the .SetFollowRedirect() function to never work if provided with "false". By adding a check to ensure that follow redirects is enabled when updating the underlying client's transport, it allows you to enable and disable redirects per request, while also maintaining the custom redirect function when re-enabling follow redirects.

bogdanfinn commented 11 months ago

@sm0ke88 thank you for your contribution!