You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
545 B
24 lines
545 B
package gax
|
|
|
|
import "bytes"
|
|
|
|
// XGoogHeader is for use by the Google Cloud Libraries only.
|
|
//
|
|
// XGoogHeader formats key-value pairs.
|
|
// The resulting string is suitable for x-goog-api-client header.
|
|
func XGoogHeader(keyval ...string) string {
|
|
if len(keyval) == 0 {
|
|
return ""
|
|
}
|
|
if len(keyval)%2 != 0 {
|
|
panic("gax.Header: odd argument count")
|
|
}
|
|
var buf bytes.Buffer
|
|
for i := 0; i < len(keyval); i += 2 {
|
|
buf.WriteByte(' ')
|
|
buf.WriteString(keyval[i])
|
|
buf.WriteByte('/')
|
|
buf.WriteString(keyval[i+1])
|
|
}
|
|
return buf.String()[1:]
|
|
}
|
|
|