1
0
Fork 0
forked from forgejo/forgejo

Clean up some variable declarations

This commit is contained in:
Anthony Wang 2022-03-30 15:52:52 -05:00
parent 65016b2664
commit 1da0d49de7
No known key found for this signature in database
GPG key ID: BC96B00AEC5F2D76
4 changed files with 19 additions and 24 deletions

View file

@ -23,7 +23,7 @@ import (
const (
// ActivityStreamsContentType const
ActivityStreamsContentType = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""
ActivityStreamsContentType = `application/ld+json; profile="https://www.w3.org/ns/activitystreams"`
)
func containsRequiredHTTPHeaders(method string, headers []string) error {
@ -31,13 +31,13 @@ func containsRequiredHTTPHeaders(method string, headers []string) error {
for _, header := range headers {
hasRequestTarget = hasRequestTarget || header == httpsig.RequestTarget
hasDate = hasDate || header == "Date"
hasDigest = method == "GET" || hasDigest || header == "Digest"
hasDigest = hasDigest || header == "Digest"
}
if !hasRequestTarget {
return fmt.Errorf("missing http header for %s: %s", method, httpsig.RequestTarget)
} else if !hasDate {
return fmt.Errorf("missing http header for %s: Date", method)
} else if !hasDigest {
} else if !hasDigest && method != http.MethodGet {
return fmt.Errorf("missing http header for %s: Digest", method)
}
return nil