Exemplo n.º 1
0
        protected override async Task <(string Description, WebhookJob Data)> CreateJobAsync(Envelope <AppEvent> @event, string eventName, WebhookAction action)
        {
            var body = formatter.ToRouteData(@event, eventName).ToString(Formatting.Indented);

            var ruleDescription = $"Send event to webhook '{action.Url}'";
            var ruleJob         = new WebhookJob
            {
                RequestUrl       = await formatter.FormatStringAsync(action.Url.ToString(), @event),
                RequestSignature = $"{body}{action.SharedSecret}".Sha256Base64(),
                RequestBodyV2    = body
            };

            return(ruleDescription, ruleJob);
        }
Exemplo n.º 2
0
        protected override (string Description, RuleJobData Data) CreateJob(Envelope <AppEvent> @event, string eventName, WebhookAction action)
        {
            var body = formatter.ToRouteData(@event, eventName);

            var signature = $"{body.ToString(Formatting.Indented)}{action.SharedSecret}".Sha256Base64();

            var ruleDescription = $"Send event to webhook '{action.Url}'";
            var ruleData        = new RuleJobData
            {
                ["RequestUrl"]       = action.Url,
                ["RequestBody"]      = body,
                ["RequestSignature"] = signature
            };

            return(ruleDescription, ruleData);
        }
Exemplo n.º 3
0
        public void Should_serialize_object_to_json()
        {
            var result = sut.ToRouteData(new { Value = 1 });

            Assert.True(result is JObject);
        }