mccutchen / go-httpbin

A reasonably complete and well-tested golang port of httpbin, with zero dependencies outside the go stdlib.
https://httpbingo.org
MIT License
596 stars 124 forks source link

feat: add /websocket/echo endpoint #155

Closed mccutchen closed 11 months ago

mccutchen commented 11 months ago

Here we add a new /websocket/echo endpoint, which implements a basic WebSocket echo service.

The endpoint is powered by our own basic, zero-dependency WebSocket implementation, which passes almost every test in the invaluable Autobahn Testsuite "fuzzingclient" set of integration tests, which will be run automatically as part of our continuous integration tests going forward.

The Autobahn Testsuite exceptions are documented here: https://github.com/mccutchen/go-httpbin/blob/c7f36ed865b75fde01e5890e8f5d1137cc2377d4/httpbin/websocket/websocket_autobahn_test.go#L27-L38

Closes #151.

codecov[bot] commented 11 months ago

Codecov Report

Merging #155 (d45c7b2) into main (c440f9a) will decrease coverage by 3.45%. The diff coverage is 78.27%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #155 +/- ## ========================================== - Coverage 98.05% 94.60% -3.45% ========================================== Files 8 9 +1 Lines 1591 1927 +336 ========================================== + Hits 1560 1823 +263 - Misses 22 71 +49 - Partials 9 33 +24 ``` | [Files](https://app.codecov.io/gh/mccutchen/go-httpbin/pull/155?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Will+McCutchen) | Coverage Δ | | |---|---|---| | [httpbin/handlers.go](https://app.codecov.io/gh/mccutchen/go-httpbin/pull/155?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Will+McCutchen#diff-aHR0cGJpbi9oYW5kbGVycy5nbw==) | `99.48% <100.00%> (+0.02%)` | :arrow_up: | | [httpbin/httpbin.go](https://app.codecov.io/gh/mccutchen/go-httpbin/pull/155?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Will+McCutchen#diff-aHR0cGJpbi9odHRwYmluLmdv) | `100.00% <100.00%> (ø)` | | | [httpbin/middleware.go](https://app.codecov.io/gh/mccutchen/go-httpbin/pull/155?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Will+McCutchen#diff-aHR0cGJpbi9taWRkbGV3YXJlLmdv) | `100.00% <100.00%> (ø)` | | | [httpbin/websocket/websocket.go](https://app.codecov.io/gh/mccutchen/go-httpbin/pull/155?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Will+McCutchen#diff-aHR0cGJpbi93ZWJzb2NrZXQvd2Vic29ja2V0Lmdv) | `75.08% <75.08%> (ø)` | |
mccutchen commented 11 months ago

Gonna land this, despite code coverage regressions. We can follow up with expaneded websockets tests to improve some of the gaps. In particular, would be good to test the frame and message size limit logic.