mirror of
https://github.com/mmahdium/HoolIt.git
synced 2026-09-28 01:41:42 +03:30
Update HTTP routes and headers for dweet APIs, adjust SSE response content type, and add TODO for metrics
This commit is contained in:
+15
-4
@@ -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
|
Accept: application/json
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
GET {{HoolIt_HostAddress}}/todos/1
|
### Listen for live dweets from a feed (server-sent style, newline-delimited JSON)
|
||||||
Accept: application/json
|
|
||||||
|
GET {{HoolIt_HostAddress}}/listen/for/dweets/from/my-feed-id
|
||||||
|
Accept: application/x-ndjson
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|||||||
+2
-2
@@ -47,13 +47,13 @@ createApi.MapGet("/{*feedId}", (HttpContext context, string feedId) =>
|
|||||||
With = dweet
|
With = dweet
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
// TODO: Add metrics
|
||||||
// Subscribe endpoint
|
// Subscribe endpoint
|
||||||
var getLiveDataApi = app.MapGroup("/listen/for/dweets/from");
|
var getLiveDataApi = app.MapGroup("/listen/for/dweets/from");
|
||||||
getLiveDataApi.MapGet("/{*feedId}", async (HttpContext context, string feedId, CancellationToken reqCancellationToken) =>
|
getLiveDataApi.MapGet("/{*feedId}", async (HttpContext context, string feedId, CancellationToken reqCancellationToken) =>
|
||||||
{
|
{
|
||||||
context.Response.StatusCode = 200;
|
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.CacheControl = "no-cache";
|
||||||
context.Response.Headers["X-Content-Type-Options"] = "nosniff";
|
context.Response.Headers["X-Content-Type-Options"] = "nosniff";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user