-
-
Notifications
You must be signed in to change notification settings - Fork 106
Be able to handle non-default http clients #6
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
Conversation
+1 @timkaye11 Can this be used to work with |
@pires I believe so - you'd just have to call |
@timkaye11 didn't work. |
@timkaye11 what is now obvious to me is that I had to comment the line you linked and it worked. Ofc, commenting said line will break runtime. |
Be able to handle non-default http clients
@timkaye11 thanks! |
Although RFC 2616 has been superseded with RFC 9110, some client implementation still rely on certain behavious regarding the Status-Line. Now, as httpmock currently implements it, per [RFC 9110#6.2-1](https://www.rfc-editor.org/rfc/rfc9110.html#section-6.2-1), the "reason phrase" is actually optional, and you need only to include the status code. Back in the days of [RFC 2616](https://www.rfc-editor.org/rfc/rfc2616.html#section-6.1), per jarcoal#6.1, the Status-Line had to contain both the status code (eg. 200) and its textual representation (eg. OK). Change code is directly stolen from the Go standard library. Signed-off-by: Cléo Rebert <cleo.rebert@gmail.com>
Although RFC 2616 has been superseded with RFC 9110, some client implementation still rely on certain behavious regarding the Status-Line. Now, as httpmock currently implements it, per [RFC 9110#6.2-1](https://www.rfc-editor.org/rfc/rfc9110.html#section-6.2-1), the "reason phrase" is actually optional, and you need only to include the status code. Back in the days of [RFC 2616](https://www.rfc-editor.org/rfc/rfc2616.html#section-6.1), per jarcoal#6.1, the Status-Line had to contain both the status code (eg. 200) and its textual representation (eg. OK). Change code is directly stolen from the Go standard library. Signed-off-by: Cléo Rebert <cleo.rebert@gmail.com>
Although RFC 2616 has been superseded with RFC 9110, some client implementation still rely on certain behavious regarding the Status-Line. Now, as httpmock currently implements it, per [RFC 9110#6.2-1](https://www.rfc-editor.org/rfc/rfc9110.html#section-6.2-1), the "reason phrase" is actually optional, and you need only to include the status code. Back in the days of [RFC 2616](https://www.rfc-editor.org/rfc/rfc2616.html#section-6.1), per #6.1, the Status-Line had to contain both the status code (eg. 200) and its textual representation (eg. OK). Change code is directly stolen from the Go standard library. Signed-off-by: Cléo Rebert <cleo.rebert@gmail.com>
In order to enable mock testing, we currently replace the
http.DefaultTransport
with the mock transport in theActivate
function. However, we run into errors when we use clients other thanhttp.DefaultClient
(which uses the default transport). In order to handle non-default clients, this PR introduces theActivateNonDefault
function, which replaces custom thehttp.Transport
with the mock transport for customhttp.Clients
.Also bumped travis to the newest version and added a unit test for the new function.