MCPcopy Create free account
hub / github.com/awslabs/llrt / json

Method json

modules/llrt_fetch/src/request.rs:408–421  ·  view source on GitHub ↗
(&self, ctx: Ctx<'js>)

Source from the content-addressed store, hash-verified

406 }
407
408 pub fn json(&self, ctx: Ctx<'js>) -> Result<Promise<'js>> {
409 let body = match self.take_body_sync(&ctx) {
410 Ok(b) => b,
411 Err(e) => return reject_with_error(&ctx, e),
412 };
413 let ctx_clone = ctx.clone();
414 Promise::wrap_future(&ctx, async move {
415 let bytes_opt = resolve_body_taken(&ctx_clone, body).await?;
416 if let Some(bytes) = bytes_opt {
417 return json_parse(&ctx_clone, strip_bom(bytes));
418 }
419 Err(Exception::throw_syntax(&ctx_clone, "JSON input is empty"))
420 })
421 }
422
423 fn array_buffer(&self, ctx: Ctx<'js>) -> Result<Promise<'js>> {
424 let body = match self.take_body_sync(&ctx) {

Callers 4

lambda-server.jsFile · 0.45
TodoList.tsxFile · 0.45

Calls 6

reject_with_errorFunction · 0.85
resolve_body_takenFunction · 0.85
json_parseFunction · 0.85
strip_bomFunction · 0.85
take_body_syncMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected