From cbebead2aaae2d3cb9b731be8624c49d589b5417 Mon Sep 17 00:00:00 2001 From: Izimic Date: Thu, 26 Nov 2020 16:15:04 +0100 Subject: [PATCH] adding payload --- src/webhooksd.cr | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/webhooksd.cr b/src/webhooksd.cr index 7a0a158..569434f 100644 --- a/src/webhooksd.cr +++ b/src/webhooksd.cr @@ -1,5 +1,6 @@ require "http/server" require "option_parser" +require "./payload.cr" VERSION = 0.1 port = 3000 @@ -22,12 +23,13 @@ OptionParser.parse do |parser| end server = HTTP::Server.new do |context| - pp context.request if context.request.method != "POST" || context.request.path != "/" context.response.status = HTTP::Status::NOT_FOUND else + payload = Payload.new(context.request) + context.response.content_type = "text/plain" - context.response.print "Hello world! The time is #{Time.local}" + context.response.print payload.to_json end end