Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zjjhot committed Mar 9, 2024
1 parent 4564fbd commit d0615dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions routers/web/repo/setting/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ func wechatworkHookParams(ctx *context.Context) webhookParams {
Type: webhook_module.WECHATWORK,
URL: form.PayloadURL,
ContentType: webhook.ContentTypeJSON,
HTTPMethod: http.MethodPost,
WebhookForm: form.WebhookForm,
}
}
Expand Down
7 changes: 6 additions & 1 deletion services/webhook/payloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ func newJSONRequest[T any](pc payloadConvertor[T], w *webhook_model.Webhook, t *
return nil, nil, err
}

req, err := http.NewRequest(w.HTTPMethod, w.URL, bytes.NewReader(body))
method := w.HTTPMethod
if method == "" {
method = http.MethodPost
}

req, err := http.NewRequest(method, w.URL, bytes.NewReader(body))
if err != nil {
return nil, nil, err
}
Expand Down

0 comments on commit d0615dd

Please sign in to comment.