I would love for net/http experts to take a look at the "Why this package exists" section of the README, as well as the horrible hack required to make things work:Please let me know if you have suggestions for simpler approaches and/or spot any bugs in my implementation.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/-I5IZgJosYE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Yes, I thought about it :).Did you read the "Why this package exists” section of the README?
On 10 Nov 2016, at 15:25, Ian Davis <m...@iandavis.com> wrote:
On 10 Nov 2016, at 15:59, Ian Davis <m...@iandavis.com> wrote:Out of interest, do you have any examples of packages that perform a type check to reject an operation with a response writer? Your implementation is complex purely to address this scenario.
I would think that 99+% of all type checks are to determine whether the supplied object provides additional functionality that can be used. I'm struggling to think of a situation where you would type check for the Flush method and then refuse to use the main ResponseWriter methods if it were a Flusher.
I would think that 99+% of all type checks are to determine whether the supplied object provides additional functionality that can be used. I'm struggling to think of a situation where you would type check for the Flush method and then refuse to use the main ResponseWriter methods if it were a Flusher.I agree. But verifying if you’re part of the 99% or 1% may be a very complex task, especially when using 3rd party http related packages.So why would I want to worry about this invariant holding for a large amount of source code, if I can fix the problem with a comparably much smaller amount of boilerplate?
On 10 Nov 2016, at 16:44, Ian Davis <m...@iandavis.com> wrote:You can't in the general case. You cover the interfaces that you currently know about but you don't know what other interfaces people are relying on. Sipporting those becomes a combinatorial problem of whack-a-mole.
To unsubscribe from this group and all its topics, send an email to golang-nuts+unsubscribe@googlegroups.com.
I think an interface like this should be provided in net/http package tomake it easy to capture the response.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/-I5IZgJosYE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
I haven't thought too much about it but there is possibly an alternative logic by having the wrappers add a Wrap() http.ResponseWriter that would return the wrappee.So first, one would test for that Wrapper interface, then return the wrappee if the test turns out to be positive. Then one could assert for various interfaces on this wrappee.Something to think about.
On 11 Nov 2016, at 12:57, atd...@gmail.com <atd...@gmail.com> wrote:Now, I don't know if it solves your issue but that's a quick thought.