feat(xo-server/_handleHttpRequest): send directly string/Buffer results

This commit is contained in:
Julien Fontanet
2020-04-17 17:09:40 +02:00
parent 462d6a4450
commit a745e42cf5

View File

@@ -145,7 +145,9 @@ export default class Xo extends EventEmitter {
}).then(
result => {
if (result != null) {
if (typeof result.pipe === 'function') {
if (typeof result === 'string' || Buffer.isBuffer(result)) {
res.end(result)
} else if (typeof result.pipe === 'function') {
result.pipe(res)
} else {
res.end(JSON.stringify(result))