Struct: eventstream.Headers

import "../ibm-cos-sdk-go-v2/aws/protocol/eventstream"

Overview

Set associates the name with a value. If the header name already exists in the Headers the value will be replaced with the new one.

Implemented Interfaces

types.AnalyticsFilter, v4.HTTPPresigner, s3.HTTPPresignerV4, types.MetricsFilter, s3.PresignPost, arn.S3ObjectLambdaARN, types.SelectObjectContentEventStream

Method Summary collapse

Method Details

func (hs Headers) Clone() Headers

Clone returns a deep copy of the headers



55
56
57
58
59
60
61
// File 'aws/protocol/eventstream/header.go', line 55

func (hs Headers) Clone() Headers { o := make(Headers, 0, len(hs)) for _, h := range hs { o.Set(h.Name, h.Value) } return o }

func (hs *Headers) Del(name string)

Del deletes the value in the Headers if it exists.



45
46
47
48
49
50
51
52
// File 'aws/protocol/eventstream/header.go', line 45

func (hs *Headers) Del(name string) { for i := 0; i < len(*hs); i++ { if (*hs)[i].Name == name { copy((*hs)[i:], (*hs)[i+1:]) (*hs) = (*hs)[:len(*hs)-1] } } }

func (hs Headers) Get(name string) Value

Get returns the Value associated with the header. Nil is returned if the value does not exist.



35
36
37
38
39
40
41
42
// File 'aws/protocol/eventstream/header.go', line 35

func (hs Headers) Get(name string) Value { for i := 0; i < len(hs); i++ { if h := hs[i]; h.Name == name { return h.Value } } return nil }

func (hs *Headers) Set(name string, value Value)



19
20
21
22
23
24
25
26
27
28
29
30
31
// File 'aws/protocol/eventstream/header.go', line 19

func (hs *Headers) Set(name string, value Value) { var i int for ; i < len(*hs); i++ { if (*hs)[i].Name == name { (*hs)[i].Value = value return } } *hs = append(*hs, Header{ Name: name, Value: value, }) }