Home / Function/ shouldHaveBody() — express Function Reference

shouldHaveBody() — express Function Reference

Architecture documentation for the shouldHaveBody() function in utils.js from the express codebase.

Entity Profile

Dependency Diagram

graph TD
  adddd7c4_6dc4_04ed_cf65_cec62d8971f2["shouldHaveBody()"]
  fc2792b2_27a7_f93a_e2de_fb2632c81d42["utils.js"]
  adddd7c4_6dc4_04ed_cf65_cec62d8971f2 -->|defined in| fc2792b2_27a7_f93a_e2de_fb2632c81d42
  style adddd7c4_6dc4_04ed_cf65_cec62d8971f2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

test/support/utils.js lines 28–36

function shouldHaveBody (buf) {
  return function (res) {
    var body = !Buffer.isBuffer(res.body)
      ? Buffer.from(res.text)
      : res.body
    assert.ok(body, 'response has body')
    assert.strictEqual(body.toString('hex'), buf.toString('hex'))
  }
}

Domain

Subdomains

Frequently Asked Questions

What does shouldHaveBody() do?
shouldHaveBody() is a function in the express codebase, defined in test/support/utils.js.
Where is shouldHaveBody() defined?
shouldHaveBody() is defined in test/support/utils.js at line 28.

Analyze Your Own Codebase

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

Try Supermodel Free