Skip to content
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

feat: add Server-Timing headers/trailers where relevant #186

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

mccutchen
Copy link
Owner

Here we add Server-Timing headers/trailers to endpoints that let clients control response timing:

  • /delay (header)
  • /drip (header)
  • /sse (trailer)

Here's how this timing info is surfaced in the Firefox network inspector for the /sse endpoint:

Screenshot 2024-09-17 at 12 27 53 AM

Copy link

codecov bot commented Sep 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.20%. Comparing base (dc8fb20) to head (cef3e74).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #186      +/-   ##
==========================================
+ Coverage   95.13%   95.20%   +0.06%     
==========================================
  Files          10       10              
  Lines        1725     1750      +25     
==========================================
+ Hits         1641     1666      +25     
  Misses         48       48              
  Partials       36       36              
Files with missing lines Coverage Δ
httpbin/handlers.go 99.22% <100.00%> (+0.01%) ⬆️
httpbin/helpers.go 95.66% <100.00%> (+0.08%) ⬆️

@mccutchen mccutchen merged commit 34a21a3 into main Sep 17, 2024
7 checks passed
@mccutchen mccutchen deleted the server-timing-trailer branch September 17, 2024 04:42
mccutchen added a commit to mccutchen/httpbingo.org that referenced this pull request Sep 19, 2024
In mccutchen/go-httpbin#184 and mccutchen/go-httpbin#186, go-httpbin added HTTP
trailers to some endpoints. Our current host, fly.io, does not support trailers
for HTTP/1.1 requests, but does support them for HTTP/2 requests. Properly
handling HTTP/2 requests requires opting in to using the h2c protocol
(basically, HTTP/2 in cleartext, masquerading as HTTP/1.1).

See discussion here for more context:
https://community.fly.io/t/support-for-http-trailers/21915
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.

1 participant