Skip to content

Commit 95fdb99

Browse files
authored
Make httpbin.HTTPBin implement http.Handler interface (#100)
This is a very small improvement to developer ergonomics.
1 parent 880bfa1 commit 95fdb99

File tree

5 files changed

+124
-114
lines changed

5 files changed

+124
-114
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import (
6262

6363
func TestSlowResponse(t *testing.T) {
6464
app := httpbin.New()
65-
testServer := httptest.NewServer(app.Handler())
65+
testServer := httptest.NewServer(app)
6666
defer testServer.Close()
6767

6868
client := http.Client{

example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
func TestSlowResponse(t *testing.T) {
1414
app := httpbin.New()
15-
testServer := httptest.NewServer(app.Handler())
15+
testServer := httptest.NewServer(app)
1616
defer testServer.Close()
1717

1818
client := http.Client{

examples/custom-instrumentation/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import (
1313
func main() {
1414
statsdClient, _ := statsd.New("")
1515

16-
h := httpbin.New(
16+
app := httpbin.New(
1717
httpbin.WithObserver(datadogObserver(statsdClient)),
1818
)
1919

2020
listenAddr := "0.0.0.0:8080"
21-
http.ListenAndServe(listenAddr, h.Handler())
21+
http.ListenAndServe(listenAddr, app)
2222
}
2323

2424
func datadogObserver(client statsd.ClientInterface) httpbin.Observer {

0 commit comments

Comments
 (0)