2 ms·
Sure, I didn't say it was impossible to convert your proposed Response type to a proper net/http response when you need it. But, like I said and you just demon
by sjustinas 13y ago
Sure, I didn't say it was impossible to convert your proposed Response type to a proper net/http response when you need it.
But, like I said and you just demonstrated, glue code is needed to do that. That makes people write differing middleware application mechanisms that are incompatible with each other.
Sure, ResponseRecorder is placed in net/http/httptest and that makes sense. But then again, nothing in the actual implementation is integrated with the testing package or tied to testing in general. IMO there's nothing that makes it unsuitable for other usage. It's a simple buffer to accumulate HTTP, that's it. Even if one were to implement a buffering writer like that on their own, it wouldn't differ too much.