aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Coquand <marcc@fastmail.fr>2023-12-02 11:45:36 -0600
committerMarc Coquand <marcc@fastmail.fr>2023-12-02 11:45:36 -0600
commit3fd0ae419ff2dadb0a566a28c042333affbb03b4 (patch)
tree6bd04d3bfa97c5d4aa1723073ca18afe72a7f2c1
parent041d0ef79d2f29ffdc2708cc535f6e4ee1f6c92d (diff)
downloadwormhole-3fd0ae419ff2dadb0a566a28c042333affbb03b4.tar.gz
wormhole-3fd0ae419ff2dadb0a566a28c042333affbb03b4.tar.bz2
wormhole-3fd0ae419ff2dadb0a566a28c042333affbb03b4.zip
Print headers
-rw-r--r--bin/main.ml9
1 files 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