MCPcopy
hub / github.com/nodejs/undici / postServer

Function postServer

test/client.js:637–653  ·  view source on GitHub ↗
(t, expected)

Source from the content-addressed store, hash-verified

635})
636
637function postServer (t, expected) {
638 return function (req, res) {
639 t.strictEqual(req.url, '/')
640 t.strictEqual(req.method, 'POST')
641 t.notStrictEqual(req.headers['content-length'], null)
642
643 req.setEncoding('utf8')
644 let data = ''
645
646 req.on('data', function (d) { data += d })
647
648 req.on('end', () => {
649 t.strictEqual(data, expected)
650 res.end('hello')
651 })
652 }
653}
654
655test('basic POST with string', async (t) => {
656 t = tspl(t, { plan: 7 })

Callers 1

client.jsFile · 0.70

Calls 3

setEncodingMethod · 0.80
onMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…