-
Notifications
You must be signed in to change notification settings - Fork 3
/
headers.go
36 lines (31 loc) · 1.08 KB
/
headers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package inngestgo
import (
"fmt"
"net/http"
)
const (
HeaderKeyAuthorization = "Authorization"
HeaderKeyContentType = "Content-Type"
HeaderKeyEnv = "X-Inngest-Env"
HeaderKeyExpectedServerKind = "X-Inngest-Expected-Server-Kind"
HeaderKeyNoRetry = "X-Inngest-No-Retry"
HeaderKeyRetryAfter = "Retry-After"
HeaderKeySDK = "X-Inngest-SDK"
HeaderKeyServerKind = "X-Inngest-Server-Kind"
HeaderKeySignature = "X-Inngest-Signature"
HeaderKeySyncKind = "x-inngest-sync-kind"
HeaderKeyUserAgent = "User-Agent"
)
var (
HeaderValueSDK = fmt.Sprintf("%s:v%s", SDKLanguage, SDKVersion)
)
func SetBasicRequestHeaders(req *http.Request) {
req.Header.Set(HeaderKeyContentType, "application/json")
req.Header.Set(HeaderKeySDK, HeaderValueSDK)
req.Header.Set(HeaderKeyUserAgent, HeaderValueSDK)
}
func SetBasicResponseHeaders(w http.ResponseWriter) {
w.Header().Set(HeaderKeyContentType, "application/json")
w.Header().Set(HeaderKeySDK, HeaderValueSDK)
w.Header().Set(HeaderKeyUserAgent, HeaderValueSDK)
}