diff options
Diffstat (limited to 'ext/http/01_http.js')
-rw-r--r-- | ext/http/01_http.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/ext/http/01_http.js b/ext/http/01_http.js index 4e6b8fc00..9ce6997c6 100644 --- a/ext/http/01_http.js +++ b/ext/http/01_http.js @@ -199,11 +199,17 @@ SetPrototypeDelete(httpConn.managedResources, responseSenderRid); let responseBodyRid; try { - responseBodyRid = await core.opAsync("op_http_response", [ - responseSenderRid, - innerResp.status ?? 200, - innerResp.headerList, - ], respBody instanceof Uint8Array ? respBody : null); + responseBodyRid = await core.opAsync( + "op_http_response", + [ + responseSenderRid, + innerResp.status ?? 200, + innerResp.headerList, + ], + (respBody instanceof Uint8Array || typeof respBody === "string") + ? respBody + : null, + ); } catch (error) { const connError = httpConn[connErrorSymbol]; if (error instanceof BadResource && connError != null) { |