Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
early return for string response
Once we know we're doing the string response type, there's no need to go
through the rest of the function.
  • Loading branch information
bengl authored and talbenari1 committed Jul 27, 2019
1 parent c5b5053 commit 8fd4ab1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions js/bootstrap/inbound.js
Expand Up @@ -105,7 +105,8 @@ async function getResponse(reqId, fn, url, request) {
switch (typeof response) {
case 'string': {
// handle it in native code
break;
stringResponse(response, reqId);
return;
}
case 'object': {
if (response === null) {
Expand Down Expand Up @@ -137,9 +138,7 @@ async function getResponse(reqId, fn, url, request) {
throw new TypeError(`Invalid response type "${typeof response}"`);
}

if (typeof response === 'string') {
stringResponse(response, reqId);
} else if (response.body) {
if (response.body) {
startResponse(response, reqId);
let stream =
response.body instanceof TransformStream
Expand Down

0 comments on commit 8fd4ab1

Please sign in to comment.