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. --- field_string.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'field_string.go') diff --git a/field_string.go b/field_string.go index f12d2d5..e0007e9 100644 --- a/field_string.go +++ b/field_string.go @@ -22,12 +22,12 @@ package schwift //whose value is a string. It cannot be directly constructed, but methods on //the Headers types return this type. For example: // -// hdr := make(AccountHeaders) -// //the following two statements are equivalent: -// hdr["X-Container-Read"] = ".r:*,.rlistings" -// hdr.ReadACL().Set(".r:*,.rlistings") +// hdr := NewAccountHeaders() +// //the following two statements are equivalent: +// hdr["X-Container-Read"] = ".r:*,.rlistings" +// hdr.ReadACL().Set(".r:*,.rlistings") type FieldString struct { - h headerInterface + h Headers k string } -- cgit v1.2.3