rcserver: set Last-Modified
header for files served by --rc-serve
This commit is contained in:
parent
3d473eb54e
commit
94cdb00eb6
3 changed files with 24 additions and 1 deletions
|
@ -93,13 +93,14 @@ const (
|
|||
// SeekModes contains all valid SeekMode's
|
||||
var SeekModes = []SeekMode{SeekModeNone, SeekModeRegular, SeekModeRange}
|
||||
|
||||
// ContentMockObject mocks an fs.Object and has content
|
||||
// ContentMockObject mocks an fs.Object and has content, mod time
|
||||
type ContentMockObject struct {
|
||||
Object
|
||||
content []byte
|
||||
seekMode SeekMode
|
||||
f fs.Fs
|
||||
unknownSize bool
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
// WithContent returns an fs.Object with the given content.
|
||||
|
@ -192,6 +193,18 @@ func (o *ContentMockObject) Hash(ctx context.Context, t hash.Type) (string, erro
|
|||
return hasher.Sums()[t], nil
|
||||
}
|
||||
|
||||
// ModTime returns the modification date of the file
|
||||
// It should return a best guess if one isn't available
|
||||
func (o *ContentMockObject) ModTime(ctx context.Context) time.Time {
|
||||
return o.modTime
|
||||
}
|
||||
|
||||
// SetModTime sets the metadata on the object to set the modification date
|
||||
func (o *ContentMockObject) SetModTime(ctx context.Context, t time.Time) error {
|
||||
o.modTime = t
|
||||
return nil
|
||||
}
|
||||
|
||||
type readCloser struct{ io.Reader }
|
||||
|
||||
func (r *readCloser) Close() error { return nil }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue