fix: Added accept-range, Content-range and x-amz-tagging-count headers in GetObject action response, added test cases for these

This commit is contained in:
jonaustin09
2023-07-25 20:28:40 +04:00
parent 7c08ea44a6
commit c598ee5416
4 changed files with 34 additions and 0 deletions

View File

@@ -1035,6 +1035,14 @@ func TestRangeGet(s *S3Conf) {
}
defer out.Body.Close()
if getString(out.ContentRange) != fmt.Sprintf("bytes 100-200/%v", datalen) {
failF("%v: expected content range: %v, instead got: %v", testname, fmt.Sprintf("bytes 100-200/%v", datalen), getString(out.ContentRange))
return
}
if getString(out.AcceptRanges) != rangeString {
failF("%v: expected accept range: %v, instead got: %v", testname, rangeString, getString(out.AcceptRanges))
}
b, err := io.ReadAll(out.Body)
if err != nil {
failF("%v: read body %v", testname, err)

View File

@@ -154,3 +154,10 @@ func execCommand(args ...string) ([]byte, error) {
return cmd.CombinedOutput()
}
func getString(str *string) string {
if str == nil {
return ""
}
return *str
}