diff options
| author | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2024-07-01 13:00:39 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-01 01:00:39 -0700 |
| commit | 5ffacbb6eacaad6ea9558d18f9c62be2a3c4e18f (patch) | |
| tree | bf5797c6b002d953d03ae68fa37c7c4be7fabc40 /weed/server/volume_server_handlers_read.go | |
| parent | 0fdf7eca48892b5c6d12c1c96563755945331f16 (diff) | |
| download | seaweedfs-5ffacbb6eacaad6ea9558d18f9c62be2a3c4e18f.tar.xz seaweedfs-5ffacbb6eacaad6ea9558d18f9c62be2a3c4e18f.zip | |
refactor all methods strings to const (#5726)
Diffstat (limited to 'weed/server/volume_server_handlers_read.go')
| -rw-r--r-- | weed/server/volume_server_handlers_read.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/weed/server/volume_server_handlers_read.go b/weed/server/volume_server_handlers_read.go index a7f8e9147..ccbd42054 100644 --- a/weed/server/volume_server_handlers_read.go +++ b/weed/server/volume_server_handlers_read.go @@ -84,7 +84,7 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) u, _ := url.Parse(util.NormalizeUrl(lookupResult.Locations[0].Url)) r.URL.Host = u.Host r.URL.Scheme = u.Scheme - request, err := http.NewRequest("GET", r.URL.String(), nil) + request, err := http.NewRequest(http.MethodGet, r.URL.String(), nil) if err != nil { glog.V(0).Infof("failed to instance http request of url %s: %v", r.URL.String(), err) InternalError(w) @@ -253,7 +253,7 @@ func shouldAttemptStreamWrite(hasLocalVolume bool, ext string, r *http.Request) if len(ext) > 0 { ext = strings.ToLower(ext) } - if r.Method == "HEAD" { + if r.Method == http.MethodHead { return true, true } _, _, _, shouldResize := shouldResizeImages(ext, r) @@ -379,7 +379,7 @@ func writeResponseContent(filename, mimeType string, rs io.ReadSeeker, w http.Re AdjustPassthroughHeaders(w, r, filename) - if r.Method == "HEAD" { + if r.Method == http.MethodHead { w.Header().Set("Content-Length", strconv.FormatInt(totalSize, 10)) return nil } @@ -408,7 +408,7 @@ func (vs *VolumeServer) streamWriteResponseContent(filename string, mimeType str w.Header().Set("Accept-Ranges", "bytes") AdjustPassthroughHeaders(w, r, filename) - if r.Method == "HEAD" { + if r.Method == http.MethodHead { w.Header().Set("Content-Length", strconv.FormatInt(totalSize, 10)) return } |
