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 /sse endpoint to test Server-Sent Events #160

Merged
merged 2 commits into from
Dec 12, 2023
Merged

feat: add /sse endpoint to test Server-Sent Events #160

merged 2 commits into from
Dec 12, 2023

Conversation

mccutchen
Copy link
Owner

Each event is a "ping" that includes an incrementing integer ID and an integer Unix timestamp with millisecond resolution:

event: ping
data: {"id":9,"timestamp":1702417925258}

Fixes #150.

Each event is a "ping" that includes an incrementing integer ID and an
integer Unix timestamp with millisecond resolution:

    event: ping
    data: {"id":9,"timestamp":1702417925258}

Fixes #150.
Comment on lines -100 to -119

mux.HandleFunc("/", methods(h.Index, "GET"))
mux.HandleFunc("/forms/post", methods(h.FormsPost, "GET"))
mux.HandleFunc("/encoding/utf8", methods(h.UTF8, "GET"))

mux.HandleFunc("/delete", methods(h.RequestWithBody, "DELETE"))
mux.HandleFunc("/get", methods(h.Get, "GET"))
mux.HandleFunc("/head", methods(h.Get, "HEAD"))
mux.HandleFunc("/patch", methods(h.RequestWithBody, "PATCH"))
mux.HandleFunc("/post", methods(h.RequestWithBody, "POST"))
mux.HandleFunc("/put", methods(h.RequestWithBody, "PUT"))

mux.HandleFunc("/absolute-redirect/", h.AbsoluteRedirect)
mux.HandleFunc("/anything", h.Anything)
mux.HandleFunc("/anything/", h.Anything)

mux.HandleFunc("/ip", h.IP)
mux.HandleFunc("/user-agent", h.UserAgent)
mux.HandleFunc("/headers", h.Headers)
mux.HandleFunc("/response-headers", h.ResponseHeaders)
mux.HandleFunc("/hostname", h.Hostname)
Copy link
Owner Author

Choose a reason for hiding this comment

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

Aside from adding the new /sse endpoint, this is just consolidating and alphabetizing the entries

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

Merging #160 (2fc547a) into main (c86dfa0) will increase coverage by 0.15%.
Report is 1 commits behind head on main.
The diff coverage is 99.27%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #160      +/-   ##
==========================================
+ Coverage   94.90%   95.05%   +0.15%     
==========================================
  Files           9        9              
  Lines        2059     2122      +63     
==========================================
+ Hits         1954     2017      +63     
  Misses         71       71              
  Partials       34       34              
Files Coverage Δ
httpbin/handlers.go 99.57% <100.00%> (+0.04%) ⬆️
httpbin/httpbin.go 100.00% <100.00%> (ø)
httpbin/static_assets.go 75.00% <80.00%> (-7.61%) ⬇️

@mccutchen mccutchen merged commit 21c68b8 into main Dec 12, 2023
8 checks passed
@mccutchen mccutchen deleted the sse branch December 12, 2023 23:04
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.

feat: add /sse endpoint to test Server-Sent Events
1 participant