express.raw.js — express Source File
Architecture documentation for express.raw.js, a javascript file in the express codebase.
Entity Profile
Relationship Graph
Source Code
'use strict'
var assert = require('node:assert')
var AsyncLocalStorage = require('node:async_hooks').AsyncLocalStorage
var express = require('..')
var request = require('supertest')
const { Buffer } = require('node:buffer');
describe('express.raw()', function () {
before(function () {
this.app = createApp()
})
it('should parse application/octet-stream', function (done) {
request(this.app)
.post('/')
.set('Content-Type', 'application/octet-stream')
.send('the user is tobi')
.expect(200, { buf: '746865207573657220697320746f6269' }, done)
})
it('should 400 when invalid content-length', function (done) {
var app = express()
app.use(function (req, res, next) {
req.headers['content-length'] = '20' // bad length
next()
})
app.use(express.raw())
app.post('/', function (req, res) {
if (Buffer.isBuffer(req.body)) {
res.json({ buf: req.body.toString('hex') })
} else {
res.json(req.body)
}
})
request(app)
.post('/')
.set('Content-Type', 'application/octet-stream')
.send('stuff')
.expect(400, /content length/, done)
})
it('should handle Content-Length: 0', function (done) {
request(this.app)
.post('/')
.set('Content-Type', 'application/octet-stream')
.set('Content-Length', '0')
.expect(200, { buf: '' }, done)
})
it('should handle empty message-body', function (done) {
request(this.app)
.post('/')
.set('Content-Type', 'application/octet-stream')
.set('Transfer-Encoding', 'chunked')
// ... (454 more lines)
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does express.raw.js do?
express.raw.js is a source file in the express codebase, written in javascript. It belongs to the ExpressCore domain, ApplicationInit subdomain.
What functions are defined in express.raw.js?
express.raw.js defines 1 function(s): createApp.
Where is express.raw.js in the architecture?
express.raw.js is located at test/express.raw.js (domain: ExpressCore, subdomain: ApplicationInit, directory: test).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free