Skip to content

Commit fe665a2

Browse files
committed
Improve docs
1 parent cfbc4eb commit fe665a2

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ lots of advise and code examples that suggest it to be a fairly trivial
3939
undertaking. Unfortunately everything I've seen so far has a high chance of
4040
breaking your application.
4141

42-
The main problem is that a http.ResponseWriter often implements additional
43-
interfaces such as http.Flusher, http.CloseNotifier, http.Hijacker and
44-
io.ReaderFrom. So the naive approach of just wrapping http.ResponseWriter in
45-
your own struct implementing the same interface will hide the additional
46-
interfaces mentioned above. This has a high change of introducing subtle bugs
47-
into any non-trivial application.
42+
The main problem is that a `http.ResponseWriter` often implements additional
43+
interfaces such as `http.Flusher`, `http.CloseNotifier`, `http.Hijacker` and
44+
`io.ReaderFrom`. So the naive approach of just wrapping `http.ResponseWriter`
45+
in your own struct that also implements the `http.ResponseWriter` interface
46+
will hide the additional interfaces mentioned above. This has a high change of
47+
introducing subtle bugs into any non-trivial application.
4848

4949
Another approach I've seen people take is to return a struct that implements
5050
all of the interfaces above. However, that's also problematic, because it's
@@ -59,8 +59,8 @@ exact same set of interfaces.
5959

6060
Additionally this package properly handles edge cases such as WriteHeader not
6161
being called, or called more than once, as well as concurrent calls to
62-
http.ResponseWriter methods, and even calls happening after the wrapped
63-
ServeHTTP has already returned.
62+
`http.ResponseWriter` methods, and even calls happening after the wrapped
63+
`ServeHTTP` has already returned.
6464

6565
Unfortunately this package is not perfect either. It's possible that it is
6666
still missing some interfaces provided by the go core (let me know if you find

0 commit comments

Comments
 (0)