Update HTTP routes and headers for dweet APIs, adjust SSE response content type, and add TODO for metrics

This commit is contained in:
2026-02-15 12:20:22 +03:30
parent bf945e3e98
commit f58943347d
2 changed files with 17 additions and 6 deletions
+15 -4
View File
@@ -1,11 +1,22 @@
@HoolIt_HostAddress = http://localhost:5246
@HoolIt_HostAddress = http://localhost:5030
GET {{HoolIt_HostAddress}}/todos/
### Root redirect
GET {{HoolIt_HostAddress}}/
Accept: text/html
###
### Create a dweet for a feed (query params become content)
GET {{HoolIt_HostAddress}}/dweet/for/my-feed-id?temperature=21.5&status=ok
Accept: application/json
###
GET {{HoolIt_HostAddress}}/todos/1
Accept: application/json
### Listen for live dweets from a feed (server-sent style, newline-delimited JSON)
GET {{HoolIt_HostAddress}}/listen/for/dweets/from/my-feed-id
Accept: application/x-ndjson
###
+2 -2
View File
@@ -47,13 +47,13 @@ createApi.MapGet("/{*feedId}", (HttpContext context, string feedId) =>
With = dweet
});
});
// TODO: Add metrics
// Subscribe endpoint
var getLiveDataApi = app.MapGroup("/listen/for/dweets/from");
getLiveDataApi.MapGet("/{*feedId}", async (HttpContext context, string feedId, CancellationToken reqCancellationToken) =>
{
context.Response.StatusCode = 200;
context.Response.Headers.ContentType = "text/plain; charset=utf-8";
context.Response.Headers.ContentType = "application/x-ndjson";
context.Response.Headers.CacheControl = "no-cache";
context.Response.Headers["X-Content-Type-Options"] = "nosniff";