@@ -100,80 +100,82 @@ func (hook Webhook) ParsePayload(w http.ResponseWriter, r *http.Request) {
100100 return
101101 }
102102
103+ hd := webhooks .Header (r .Header )
104+
103105 switch bitbucketEvent {
104106 case RepoPushEvent :
105107 var pl RepoPushPayload
106108 json .Unmarshal ([]byte (payload ), & pl )
107- hook .runProcessPayloadFunc (fn , pl )
109+ hook .runProcessPayloadFunc (fn , pl , hd )
108110 case RepoForkEvent :
109111 var pl RepoForkPayload
110112 json .Unmarshal ([]byte (payload ), & pl )
111- hook .runProcessPayloadFunc (fn , pl )
113+ hook .runProcessPayloadFunc (fn , pl , hd )
112114 case RepoCommitCommentCreatedEvent :
113115 var pl RepoCommitCommentCreatedPayload
114116 json .Unmarshal ([]byte (payload ), & pl )
115- hook .runProcessPayloadFunc (fn , pl )
117+ hook .runProcessPayloadFunc (fn , pl , hd )
116118 case RepoCommitStatusCreatedEvent :
117119 var pl RepoCommitStatusCreatedPayload
118120 json .Unmarshal ([]byte (payload ), & pl )
119- hook .runProcessPayloadFunc (fn , pl )
121+ hook .runProcessPayloadFunc (fn , pl , hd )
120122 case RepoCommitStatusUpdatedEvent :
121123 var pl RepoCommitStatusUpdatedPayload
122124 json .Unmarshal ([]byte (payload ), & pl )
123- hook .runProcessPayloadFunc (fn , pl )
125+ hook .runProcessPayloadFunc (fn , pl , hd )
124126 case IssueCreatedEvent :
125127 var pl IssueCreatedPayload
126128 json .Unmarshal ([]byte (payload ), & pl )
127- hook .runProcessPayloadFunc (fn , pl )
129+ hook .runProcessPayloadFunc (fn , pl , hd )
128130 case IssueUpdatedEvent :
129131 var pl IssueUpdatedPayload
130132 json .Unmarshal ([]byte (payload ), & pl )
131- hook .runProcessPayloadFunc (fn , pl )
133+ hook .runProcessPayloadFunc (fn , pl , hd )
132134 case IssueCommentCreatedEvent :
133135 var pl IssueCommentCreatedPayload
134136 json .Unmarshal ([]byte (payload ), & pl )
135- hook .runProcessPayloadFunc (fn , pl )
137+ hook .runProcessPayloadFunc (fn , pl , hd )
136138 case PullRequestCreatedEvent :
137139 var pl PullRequestCreatedPayload
138140 json .Unmarshal ([]byte (payload ), & pl )
139- hook .runProcessPayloadFunc (fn , pl )
141+ hook .runProcessPayloadFunc (fn , pl , hd )
140142 case PullRequestUpdatedEvent :
141143 var pl PullRequestUpdatedPayload
142144 json .Unmarshal ([]byte (payload ), & pl )
143- hook .runProcessPayloadFunc (fn , pl )
145+ hook .runProcessPayloadFunc (fn , pl , hd )
144146 case PullRequestApprovedEvent :
145147 var pl PullRequestApprovedPayload
146148 json .Unmarshal ([]byte (payload ), & pl )
147- hook .runProcessPayloadFunc (fn , pl )
149+ hook .runProcessPayloadFunc (fn , pl , hd )
148150 case PullRequestApprovalRemovedEvent :
149151 var pl PullRequestApprovalRemovedPayload
150152 json .Unmarshal ([]byte (payload ), & pl )
151- hook .runProcessPayloadFunc (fn , pl )
153+ hook .runProcessPayloadFunc (fn , pl , hd )
152154 case PullRequestMergedEvent :
153155 var pl PullRequestMergedPayload
154156 json .Unmarshal ([]byte (payload ), & pl )
155- hook .runProcessPayloadFunc (fn , pl )
157+ hook .runProcessPayloadFunc (fn , pl , hd )
156158 case PullRequestDeclinedEvent :
157159 var pl PullRequestDeclinedPayload
158160 json .Unmarshal ([]byte (payload ), & pl )
159- hook .runProcessPayloadFunc (fn , pl )
161+ hook .runProcessPayloadFunc (fn , pl , hd )
160162 case PullRequestCommentCreatedEvent :
161163 var pl PullRequestCommentCreatedPayload
162164 json .Unmarshal ([]byte (payload ), & pl )
163- hook .runProcessPayloadFunc (fn , pl )
165+ hook .runProcessPayloadFunc (fn , pl , hd )
164166 case PullRequestCommentUpdatedEvent :
165167 var pl PullRequestCommentUpdatedPayload
166168 json .Unmarshal ([]byte (payload ), & pl )
167- hook .runProcessPayloadFunc (fn , pl )
169+ hook .runProcessPayloadFunc (fn , pl , hd )
168170 case PullRequestCommentDeletedEvent :
169171 var pl PullRequestCommentDeletedPayload
170172 json .Unmarshal ([]byte (payload ), & pl )
171- hook .runProcessPayloadFunc (fn , pl )
173+ hook .runProcessPayloadFunc (fn , pl , hd )
172174 }
173175}
174176
175- func (hook Webhook ) runProcessPayloadFunc (fn webhooks.ProcessPayloadFunc , results interface {}) {
176- go func (fn webhooks.ProcessPayloadFunc , results interface {}) {
177- fn (results )
178- }(fn , results )
177+ func (hook Webhook ) runProcessPayloadFunc (fn webhooks.ProcessPayloadFunc , results interface {}, header webhooks. Header ) {
178+ go func (fn webhooks.ProcessPayloadFunc , results interface {}, header webhooks. Header ) {
179+ fn (results , header )
180+ }(fn , results , header )
179181}
0 commit comments