(&self, ctx: Ctx<'js>)
| 421 | } |
| 422 | |
| 423 | fn array_buffer(&self, ctx: Ctx<'js>) -> Result<Promise<'js>> { |
| 424 | let body = match self.take_body_sync(&ctx) { |
| 425 | Ok(b) => b, |
| 426 | Err(e) => return reject_with_error(&ctx, e), |
| 427 | }; |
| 428 | let ctx_clone = ctx.clone(); |
| 429 | Promise::wrap_future(&ctx, async move { |
| 430 | let bytes_opt = resolve_body_taken(&ctx_clone, body).await?; |
| 431 | if let Some(bytes) = bytes_opt { |
| 432 | return ArrayBuffer::new(ctx_clone, bytes); |
| 433 | } |
| 434 | ArrayBuffer::new(ctx_clone, Vec::<u8>::new()) |
| 435 | }) |
| 436 | } |
| 437 | |
| 438 | fn bytes(&self, ctx: Ctx<'js>) -> Result<Promise<'js>> { |
| 439 | let body = match self.take_body_sync(&ctx) { |
nothing calls this directly
no test coverage detected