fix headers

This commit is contained in:
2026-02-02 13:31:48 +02:00
parent fa8563848f
commit 8e9c270972
3 changed files with 21 additions and 20 deletions
+11 -11
View File
@@ -21,7 +21,7 @@ type FileExistsParams struct {
}
type FileExistsResult struct {
ContentType string
ContentSize string
ContentLength string
ContentDigest string
}
@@ -54,7 +54,7 @@ func (oper *Operator) FileExists(param *FileExistsParams) (int, *FileExistsResul
return code, res, err
}
res = &FileExistsResult{
ContentSize: strconv.FormatInt(fileDescr.Size, 10),
ContentLength: strconv.FormatInt(fileDescr.Size, 10),
ContentType: fileDescr.Type,
ContentDigest: fileDescr.Checksum,
}
@@ -63,10 +63,10 @@ func (oper *Operator) FileExists(param *FileExistsParams) (int, *FileExistsResul
// PutFile
type PutFileParams struct {
ContentType string
ContentSize string
Filepath string
Source io.ReadCloser
ContentType string
ContentLength string
Filepath string
Source io.ReadCloser
}
type PutFileResult struct{}
@@ -76,12 +76,12 @@ func (oper *Operator) PutFile(param *PutFileParams) (int, *PutFileResult, error)
var err error
res := &PutFileResult{}
if param.ContentSize == "" {
if param.ContentLength == "" {
code := http.StatusLengthRequired
err = fmt.Errorf("Content-Size is empty")
err = fmt.Errorf("Content-Length is empty")
return code, res, err
}
size, err := strconv.ParseInt(param.ContentSize, 10, 64)
size, err := strconv.ParseInt(param.ContentLength, 10, 64)
if err != nil {
code := http.StatusLengthRequired
return code, res, err
@@ -158,7 +158,7 @@ type GetFileParams struct {
}
type GetFileResult struct {
ContentType string
ContentSize string
ContentLength string
ContentDigest string
Source io.ReadCloser
}
@@ -194,7 +194,7 @@ func (oper *Operator) GetFile(param *GetFileParams) (int, *GetFileResult, error)
return code, res, err
}
res = &GetFileResult{
ContentSize: strconv.FormatInt(fileDescr.Size, 10),
ContentLength: strconv.FormatInt(fileDescr.Size, 10),
ContentType: fileDescr.Type,
ContentDigest: fileDescr.Checksum,
Source: reader,