Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions github/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
// SHA256SignatureHeader is the GitHub header key used to pass the HMAC-SHA256 hexdigest.
SHA256SignatureHeader = "X-Hub-Signature-256"
// EventTypeHeader is the GitHub header key used to pass the event type.
EventTypeHeader = "X-Github-Event"
EventTypeHeader = "X-GitHub-Event"
// DeliveryIDHeader is the GitHub header key used to pass the unique ID for the webhook event.
DeliveryIDHeader = "X-Github-Delivery"
DeliveryIDHeader = "X-GitHub-Delivery"
)

var (
Expand Down Expand Up @@ -288,14 +288,14 @@
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/events/github-event-types
func WebHookType(r *http.Request) string {
return r.Header.Get(EventTypeHeader)

Check failure on line 291 in github/messages.go

View workflow job for this annotation

GitHub Actions / lint

const "EventTypeHeader" used as a key at http.Header, but "X-GitHub-Event" is not canonical, want "X-Github-Event" (canonicalheader)

Check failure on line 291 in github/messages.go

View workflow job for this annotation

GitHub Actions / lint

const "EventTypeHeader" used as a key at http.Header, but "X-GitHub-Event" is not canonical, want "X-Github-Event" (canonicalheader)
}

// DeliveryID returns the unique delivery ID of webhook request r.
//
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/events/github-event-types
func DeliveryID(r *http.Request) string {
return r.Header.Get(DeliveryIDHeader)

Check failure on line 298 in github/messages.go

View workflow job for this annotation

GitHub Actions / lint

const "DeliveryIDHeader" used as a key at http.Header, but "X-GitHub-Delivery" is not canonical, want "X-Github-Delivery" (canonicalheader)

Check failure on line 298 in github/messages.go

View workflow job for this annotation

GitHub Actions / lint

const "DeliveryIDHeader" used as a key at http.Header, but "X-GitHub-Delivery" is not canonical, want "X-Github-Delivery" (canonicalheader)
}

// ParseWebHook parses the event payload. For recognized event types, a
Expand All @@ -321,7 +321,7 @@
func ParseWebHook(messageType string, payload []byte) (interface{}, error) {
eventType, ok := messageToTypeName[messageType]
if !ok {
return nil, fmt.Errorf("unknown X-Github-Event in message: %v", messageType)
return nil, fmt.Errorf("unknown X-GitHub-Event in message: %v", messageType)
}

event := Event{
Expand Down
2 changes: 1 addition & 1 deletion github/messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@
if err != nil {
t.Fatalf("DeliveryID: %v", err)
}
req.Header.Set("X-Github-Delivery", id)
req.Header.Set("X-GitHub-Delivery", id)

Check failure on line 610 in github/messages_test.go

View workflow job for this annotation

GitHub Actions / lint

non-canonical header "X-GitHub-Delivery", instead use: "X-Github-Delivery" (canonicalheader)

Check failure on line 610 in github/messages_test.go

View workflow job for this annotation

GitHub Actions / lint

non-canonical header "X-GitHub-Delivery", instead use: "X-Github-Delivery" (canonicalheader)

got := DeliveryID(req)
if got != id {
Expand Down
Loading