From 3fd0ae419ff2dadb0a566a28c042333affbb03b4 Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Sat, 2 Dec 2023 11:45:36 -0600 Subject: Print headers --- bin/main.ml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/main.ml b/bin/main.ml index 3a2e106..ef7d5fa 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -54,6 +54,8 @@ let actor = } |} +let header_concat (a, b) = a ^ ": " ^ b + let () = Post.add fake_post; Post.add fake_post_2; @@ -69,11 +71,11 @@ let () = Dream.get "/actor" (fun _ -> Dream.log "Sending actor"; Dream.respond actor - ~headers:[ ("Content-Type", "application/json+ld") ]); + ~headers:[ ("Content-Type", "application/activity+json") ]); Dream.get "/.well-known/webfinger" (fun _ -> Dream.log "Sending webfinger"; Dream.respond webfinger - ~headers:[ ("Content-Type", "application/json+ld") ]); + ~headers:[ ("Content-Type", "application/activity+json") ]); Dream.get "/" (fun request -> Dream.log "Sending greeting to %s!" (Dream.client request); let posts = Post.get_all () in @@ -81,6 +83,9 @@ let () = Dream.post "/inbox" (fun request -> let%lwt body = Dream.body request in Dream.log "Got body: %s" body; + let headers = Dream.all_headers request in + Dream.log "Got headers: %s" + (String.concat " " (List.map header_concat headers)); let message_object = Yojson.Safe.from_string body |> Post.mastodon_post_of_yojson in -- cgit v1.2.3