Skip to content

Show how to test handler timeouts with http.TimeoutHandler - #170

Merged
steinfletcher merged 1 commit into
masterfrom
timeout-handler-example
Sep 3, 2026
Merged

Show how to test handler timeouts with http.TimeoutHandler#170
steinfletcher merged 1 commit into
masterfrom
timeout-handler-example

Conversation

@steinfletcher

Copy link
Copy Markdown
Owner

Summary

Addresses #153. http.TimeoutHandler from the standard library already works with apitest, so rather than adding an API this makes the answer discoverable:

  • TestApiTest_SupportsTimeoutHandler proves a handler that overruns http.TimeoutHandler yields the 503 and message under apitest, and that a fast handler completes normally. Runs in ~20ms.
  • A "Test handler timeouts" README recipe showing the wrapping, with a pointer to WithContext for deadline tests.

No code changes to the library.

Closes #153

🤖 Generated with Claude Code

Adds a test proving that a handler wrapped in the standard library's
http.TimeoutHandler produces the expected 503 under apitest, and a
README recipe pointing to it.

Closes #153

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@steinfletcher
steinfletcher merged commit 2524843 into master Sep 3, 2026
3 checks passed
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.

Implement TimeoutHandler

1 participant