Home / Function/ getDefaultJsonParser() — fastify Function Reference

getDefaultJsonParser() — fastify Function Reference

Architecture documentation for the getDefaultJsonParser() function in content-type-parser.js from the fastify codebase.

Entity Profile

Dependency Diagram

graph TD
  7f1adcd1_a085_05c7_d640_bc45d65ddcb4["getDefaultJsonParser()"]
  b47c11f3_fe3b_64dc_0f58_921e5921ec45["content-type-parser.js"]
  7f1adcd1_a085_05c7_d640_bc45d65ddcb4 -->|defined in| b47c11f3_fe3b_64dc_0f58_921e5921ec45
  251437cc_c0a4_5fd8_ead1_3da0578dcbb0["ContentTypeParser()"]
  251437cc_c0a4_5fd8_ead1_3da0578dcbb0 -->|calls| 7f1adcd1_a085_05c7_d640_bc45d65ddcb4
  style 7f1adcd1_a085_05c7_d640_bc45d65ddcb4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

lib/content-type-parser.js lines 306–322

function getDefaultJsonParser (onProtoPoisoning, onConstructorPoisoning) {
  const parseOptions = { protoAction: onProtoPoisoning, constructorAction: onConstructorPoisoning }

  return defaultJsonParser

  function defaultJsonParser (req, body, done) {
    if (body.length === 0) {
      done(new FST_ERR_CTP_EMPTY_JSON_BODY(), undefined)
      return
    }
    try {
      done(null, secureJsonParse(body, parseOptions))
    } catch {
      done(new FST_ERR_CTP_INVALID_JSON_BODY(), undefined)
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does getDefaultJsonParser() do?
getDefaultJsonParser() is a function in the fastify codebase, defined in lib/content-type-parser.js.
Where is getDefaultJsonParser() defined?
getDefaultJsonParser() is defined in lib/content-type-parser.js at line 306.
What calls getDefaultJsonParser()?
getDefaultJsonParser() is called by 1 function(s): ContentTypeParser.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free