diff --git a/client/space_lua/stdlib/net.ts b/client/space_lua/stdlib/net.ts index 58ef8fb5..d79de4e8 100644 --- a/client/space_lua/stdlib/net.ts +++ b/client/space_lua/stdlib/net.ts @@ -31,6 +31,14 @@ export const netApi = new LuaTable({ buildProxyUrl(client, url), fetchOptions, ); + if (resp.status !== 200) { + return { + ok: false, + status: resp.status, + headers: extractProxyHeaders(resp.headers), + body: await resp.text(), + }; + } // Do sensible things with the body based on the content type let body: any; const contentTypeHeader = options.responseEncoding ||