From 0d08ee8959d126d652fc42e9af63dbc8cc1d93ba Mon Sep 17 00:00:00 2001 From: bptato Date: Fri, 19 Jul 2024 18:12:44 +0200 Subject: loader: async status/headers for fetch The status code & headers are no longer guaranteed to be sent right after res/outputId, so read them asynchronously instead. (This is pretty much the same code as the buffer connection handler in pager. Hopefully we can merge the two at some point.) --- src/loader/response.nim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/loader/response.nim') diff --git a/src/loader/response.nim b/src/loader/response.nim index 8b33621e..5531da9d 100644 --- a/src/loader/response.nim +++ b/src/loader/response.nim @@ -59,13 +59,15 @@ type jsDestructor(Response) -proc newResponse*(res: int; request: Request; stream: SocketStream): Response = +proc newResponse*(res: int; request: Request; stream: SocketStream; + outputId: int; status: uint16): Response = return Response( res: res, url: request.url, body: stream, bodyRead: EmptyPromise(), - outputId: -1 + outputId: outputId, + status: status ) func makeNetworkError*(): Response {.jsstfunc: "Response.error".} = -- cgit 1.4.1-2-gfad0