コード例 #1
0
        public async Task <HandlerResult> Handler(string payload, string name, string id, string userAgent, string signature)
        {
            if (string.IsNullOrWhiteSpace(payload))
            {
                throw new ArgumentException($"'{nameof(payload)}' cannot be null or whitespace.", nameof(payload));
            }

            var result = new HandlerResult();

            result.SignatureCheck = _githubWebhookHandlerSettings.CheckSignature;

            if (_githubWebhookHandlerSettings.CheckSignature && !CheckSignature(payload, signature))
            {
                result.AddErrorMessage("secret validation failed");

                return(result);
            }

            //if (hook == null)
            //{
            //    result.AddErrorMessage("deserialization failed");

            //    return result;
            //}

            var headers = CreateHeaders(id, name, userAgent, signature);

            await EventDistribution(headers, payload);

            return(result);
        }
コード例 #2
0
        public async Task <HandlerResult> Handler(string payload, string name, string id, string userAgent, string signature)
        {
            var result = new HandlerResult();

            result.SignatureCheck = _githubWebhookHandlerSettings.CheckSignature;

            if (_githubWebhookHandlerSettings.CheckSignature && !CheckSignature(payload, signature))
            {
                result.AddErrorMessage("secret validation failed");

                return(result);
            }

            //if (hook == null)
            //{
            //    result.AddErrorMessage("deserialization failed");

            //    return result;
            //}

            var headers = CreateHeaders(id, name, userAgent, signature);

            await EventDistribution(headers, payload);

            return(result);
        }