diff options
| author | 2022-09-17 04:39:59 -0700 | |
|---|---|---|
| committer | 2022-09-17 04:39:59 -0700 | |
| commit | 31469bb05ba655a4e7db54c98ba0ecbf7df5738a (patch) | |
| tree | 1e93ca9e7b47be55313feca4df84c24f38d5a080 /src | |
| parent | b4f8e5cdb97ca30103900592002d23ad0a0f4eb2 (diff) | |
| download | bun-31469bb05ba655a4e7db54c98ba0ecbf7df5738a.tar.gz bun-31469bb05ba655a4e7db54c98ba0ecbf7df5738a.tar.zst bun-31469bb05ba655a4e7db54c98ba0ecbf7df5738a.zip | |
Prevent returning resolved promises
Diffstat (limited to 'src')
| -rw-r--r-- | src/bun.js/api/server.zig | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index 535666d2a..72d9fc6b1 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -1990,7 +1990,9 @@ pub fn NewServer(comptime ssl_enabled_: bool, comptime debug_mode_: bool) type { return JSC.JSPromise.rejectedPromiseValue(ctx, ZigString.init("fetch() returned an empty value").toErrorInstance(ctx)).asObjectRef(); } - // TODO: do this for promises too + if (response_value.asPromise() != null) { + return response_value.asObjectRef(); + } if (response_value.as(JSC.WebCore.Response)) |resp| { resp.url = this.allocator.dupe(u8, url.href) catch unreachable; |
