|
|
|
@@ -77,7 +77,7 @@ func testBucket(url string) Bucket {
|
|
|
|
|
func TestPutSendsTheBodyToItsPathStyleKey(t *testing.T) {
|
|
|
|
|
var gotPath, gotSHA, gotBody, gotAuth string
|
|
|
|
|
var gotLen int64
|
|
|
|
|
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
srv := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) {
|
|
|
|
|
gotPath, gotSHA, gotAuth, gotLen = r.URL.EscapedPath(), r.Header.Get("X-Amz-Content-Sha256"), r.Header.Get("Authorization"), r.ContentLength
|
|
|
|
|
b, _ := io.ReadAll(r.Body)
|
|
|
|
|
gotBody = string(b)
|
|
|
|
@@ -108,13 +108,13 @@ func TestListFollowsContinuationTokens(t *testing.T) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if q.Get("continuation-token") == "" {
|
|
|
|
|
fmt.Fprint(w, `<ListBucketResult><IsTruncated>true</IsTruncated><NextContinuationToken>next</NextContinuationToken>
|
|
|
|
|
_, _ = fmt.Fprint(w, `<ListBucketResult><IsTruncated>true</IsTruncated><NextContinuationToken>next</NextContinuationToken>
|
|
|
|
|
<Contents><Key>database/minstrel-20261101T030000Z.tar</Key><Size>10</Size><LastModified>2026-11-01T03:00:05.000Z</LastModified></Contents>
|
|
|
|
|
<Contents><Key>database/minstrel-20261102T030000Z.tar</Key><Size>11</Size><LastModified>2026-11-02T03:00:05.000Z</LastModified></Contents>
|
|
|
|
|
</ListBucketResult>`)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
fmt.Fprint(w, `<ListBucketResult><IsTruncated>false</IsTruncated>
|
|
|
|
|
_, _ = fmt.Fprint(w, `<ListBucketResult><IsTruncated>false</IsTruncated>
|
|
|
|
|
<Contents><Key>database/minstrel-20261103T030000Z.tar</Key><Size>12</Size><LastModified>2026-11-03T03:00:05.000Z</LastModified></Contents>
|
|
|
|
|
</ListBucketResult>`)
|
|
|
|
|
}))
|
|
|
|
@@ -131,9 +131,9 @@ func TestListFollowsContinuationTokens(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestARefusalSaysWhatIsWrong(t *testing.T) {
|
|
|
|
|
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
|
|
|
|
w.WriteHeader(http.StatusForbidden)
|
|
|
|
|
fmt.Fprint(w, `<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match</Message></Error>`)
|
|
|
|
|
_, _ = fmt.Fprint(w, `<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match</Message></Error>`)
|
|
|
|
|
}))
|
|
|
|
|
defer srv.Close()
|
|
|
|
|
|
|
|
|
|