mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 08:14:15 +00:00
carddav: set content length header for HEAD/GET requests
Now that the backend can supply this value, use it for explicitly setting the header in GET/HEAD responses if available.
This commit is contained in:
parent
a3e56141d9
commit
1e99b70a62
@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"mime"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/emersion/go-vcard"
|
||||
"github.com/emersion/go-webdav"
|
||||
@ -289,6 +290,9 @@ func (b *backend) HeadGet(w http.ResponseWriter, r *http.Request) error {
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", vcard.MIMEType)
|
||||
if ao.ContentLength > 0 {
|
||||
w.Header().Set("Content-Length", strconv.FormatInt(ao.ContentLength, 10))
|
||||
}
|
||||
if ao.ETag != "" {
|
||||
w.Header().Set("ETag", internal.ETag(ao.ETag).String())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user