Skip to content

Commit 0f26830

Browse files
committed
move noop response writer
1 parent 6ac8a92 commit 0f26830

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

coderd/httpapi/noop.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package httpapi
2+
3+
import "net/http"
4+
5+
// NoopResponseWriter is a response writer that does nothing.
6+
type NoopResponseWriter struct{}
7+
8+
func (NoopResponseWriter) Header() http.Header { return http.Header{} }
9+
func (NoopResponseWriter) Write(p []byte) (int, error) { return len(p), nil }
10+
func (NoopResponseWriter) WriteHeader(int) {}

coderd/httpmw/noop.go

Lines changed: 0 additions & 10 deletions
This file was deleted.

coderd/httpmw/userparam.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func ExtractUserParamOptional(db database.Store) func(http.Handler) http.Handler
5959
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
6060
ctx := r.Context()
6161

62-
user, ok := ExtractUserContext(ctx, db, &noopResponseWriter{}, r)
62+
user, ok := ExtractUserContext(ctx, db, &httpapi.NoopResponseWriter{}, r)
6363
if ok {
6464
ctx = context.WithValue(ctx, userParamContextKey{}, user)
6565
}

0 commit comments

Comments
 (0)