Re: [go-nuts] ResponseRecorder HTTP status code defaults to 200

2023-10-17 Thread Simon Walter
And so: https://github.com/golang/go/issues/63589 On Tuesday, October 17, 2023 at 10:44:04 AM UTC+2 Simon Walter wrote: > It is good practice to use test lang/tools/libs/etc different from what > you are using in your actual code. > > If the author has meant for the httptest packag

Re: [go-nuts] ResponseRecorder HTTP status code defaults to 200

2023-10-17 Thread Simon Walter
d to be used with `net/http`". I also genuinely don't understand how >> the behavior of `httptest` could ever cause any harm (quite the opposite). >> >> But, YMMV, of course and you are free to roll your own testing helpers. >> >> On Mon, Oct 16, 2023 at 9

Re: [go-nuts] ResponseRecorder HTTP status code defaults to 200

2023-10-16 Thread Simon Walter
e sent to the user is the right one - > why would it matter whether it was your Handler that set it, or the > framework? > > On Sun, Oct 15, 2023 at 10:22 PM Simon Walter wrote: > >> How does that explain why it is a good idea? >> >> Perhaps my concern is n

Re: [go-nuts] ResponseRecorder HTTP status code defaults to 200

2023-10-15 Thread Simon Walter
t/http` server also uses 200 as the default response code. > The behavior of an `http.Handler` not setting a response code should be the > same, if it uses `httptest`, as if it uses `net/http`. > > On Sun, Oct 15, 2023 at 5:17 PM Simon Walter wrote: > >> Hi all, >> &g

[go-nuts] ResponseRecorder HTTP status code defaults to 200

2023-10-15 Thread Simon Walter
Hi all, What is the reason that ResponseRecorder HTTP status code defaults to 200? https://cs.opensource.google/go/go/+/refs/tags/go1.21.3:src/net/http/httptest/recorder.go;drc=ff14e844d26090e09aa335d836f737c09a7a0402;l=55 https://cs.opensource.google/go/go/+/refs/tags/go1.21.3:src/net/http/http