From d23b4052c0866698b14ac13ac98581d9f5440a9b Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Sun, 11 Mar 2018 19:38:27 +0100 Subject: revamp the Headers API 1. Move common methods of AccountHeaders, ContainerHeaders, ObjectHeaders into a base type Headers. 2. Fold Headers into RequestOptions to remove one of the two optional arguments on request methods. The new Headers.ToOpts() method offers a nice experience for users passing Headers to request methods. The Update() methods keep the explicit Headers argument since the Headers argument is not optional there. The only downside is that we lose a bit of type-safety because RequestOptions takes any Headers instance, so e.g. ContainerHeaders could be passed to Object.Upload(). I believe the benefits outweigh this problem. --- tests/container_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/container_test.go') diff --git a/tests/container_test.go b/tests/container_test.go index c90a339..0efc4e6 100644 --- a/tests/container_test.go +++ b/tests/container_test.go @@ -46,17 +46,17 @@ func TestContainerLifecycle(t *testing.T) { //DELETE should be idempotent and not return success on non-existence, but //OpenStack LOVES to be inconsistent with everything (including, notably, itself) - err = c.Delete(nil, nil) + err = c.Delete(nil) expectError(t, err, "expected 204 response, got 404 instead:

Not Found

The resource could not be found.

") - err = c.Create(nil, nil) + err = c.Create(nil) expectSuccess(t, err) exists, err = c.Exists() expectSuccess(t, err) expectBool(t, exists, true) - err = c.Delete(nil, nil) + err = c.Delete(nil) expectSuccess(t, err) }) } @@ -69,7 +69,7 @@ func TestContainerUpdate(t *testing.T) { expectBool(t, hdr.ObjectCount().Exists(), true) expectUint64(t, hdr.ObjectCount().Get(), 0) - hdr = make(schwift.ContainerHeaders) + hdr = schwift.NewContainerHeaders() hdr.ObjectCountQuota().Set(23) hdr.BytesUsedQuota().Set(42) -- cgit v1.2.3