Skip to content

Commit 555a946

Browse files
committed
Add type for returning status code
1 parent d231994 commit 555a946

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

agent/files.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import (
1919
"github.com/coder/coder/v2/codersdk"
2020
)
2121

22+
type HTTPResponseCode = int
23+
2224
func (a *agent) HandleReadFile(rw http.ResponseWriter, r *http.Request) {
2325
ctx := r.Context()
2426

@@ -45,7 +47,7 @@ func (a *agent) HandleReadFile(rw http.ResponseWriter, r *http.Request) {
4547
}
4648
}
4749

48-
func (a *agent) streamFile(ctx context.Context, rw http.ResponseWriter, path string, offset, limit int64) (int, error) {
50+
func (a *agent) streamFile(ctx context.Context, rw http.ResponseWriter, path string, offset, limit int64) (HTTPResponseCode, error) {
4951
if !filepath.IsAbs(path) {
5052
return http.StatusBadRequest, xerrors.Errorf("file path must be absolute: %q", path)
5153
}
@@ -125,7 +127,7 @@ func (a *agent) HandleWriteFile(rw http.ResponseWriter, r *http.Request) {
125127
})
126128
}
127129

128-
func (a *agent) writeFile(ctx context.Context, r *http.Request, path string) (int, error) {
130+
func (a *agent) writeFile(ctx context.Context, r *http.Request, path string) (HTTPResponseCode, error) {
129131
if !filepath.IsAbs(path) {
130132
return http.StatusBadRequest, xerrors.Errorf("file path must be absolute: %q", path)
131133
}

0 commit comments

Comments
 (0)