Skip to content

fix: respect client-configured request config in NetworkHttpClient - #990

Merged
manisha1997 merged 1 commit into
mainfrom
fix/TECHEMPROD-3081-respect-response-timeout
Nov 3, 2026
Merged

manisha1997 merged 1 commit into
mainfrom
fix/TECHEMPROD-3081-respect-response-timeout

Conversation

@manisha1997

@manisha1997 manisha1997 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • NetworkHttpClient.makeRequest called setConfig(DEFAULT_REQUEST_CONFIG) on every request, overriding the RequestConfig passed to the constructor, so a user-configured response timeout was ignored.
  • Removed the override; the config set on the client builder now applies.
  • Added testCustomResponseTimeoutIsRespected, which uses a local slow server and a 300 ms response timeout.

Jira: TECHEMPROD-3081

Test plan

  • NetworkHttpClientTest passes (JDK 17)
  • Full test suite in CI

🤖 Generated with Claude Code

makeRequest overrode the RequestConfig passed to the constructor with
DEFAULT_REQUEST_CONFIG on every request, so custom response timeouts
were ignored. Remove the override so the client's default config applies.

TECHEMPROD-3081

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
HttpMethod method = request.getMethod();
HttpUriRequestBase httpUriRequestBase = createHttpUriRequestBase(request);

httpUriRequestBase.setConfig(DEFAULT_REQUEST_CONFIG);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What happens if there is no request_config set in the request?
Can we instead set default if the config is not found?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If config is not set, it is set


When the Object of NetworkHTTPClient is created.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

makes sense

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the change to honor client-configured request settings.

No open issues 🎉

What changed in this PR

Fixes NetworkHttpClient so requests respect the client-configured RequestConfig, including custom response timeouts.

Changes:

  • Removes the per-request configuration override, allowing the client builder’s configuration to apply.
  • Adds a regression test using a slow local server to verify that a 300 ms response timeout is honored.
File Description
src/​test/​java/​com/​twilio/​http/​NetworkHttpClientTest.java Adds regression coverage for custom response timeouts.
src/​main/​java/​com/​twilio/​http/​NetworkHttpClient.java Removes the default configuration override from makeRequest.

Review effort: Balanced

@manisha1997
manisha1997 merged commit 04a6dfb into main Nov 3, 2026
8 checks passed
@manisha1997
manisha1997 deleted the fix/TECHEMPROD-3081-respect-response-timeout branch November 3, 2026 13:47
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.

3 participants