Ensure we pipe the parsed body again upstream to docker

This commit is contained in:
Johannes Zellner
2018-08-16 14:28:51 +02:00
parent 83304ff66c
commit dc3e3f5f4d

View File

@@ -98,7 +98,12 @@ function containersCreate(req, res, next) {
}
function process(req, res, next) {
if (!req.readable) {
// we have to rebuild the body since we consumed in in the parser
if (req.body) {
let plainBody = JSON.stringify(req.body);
req.dockerRequest.setHeader('Content-Length', Buffer.byteLength(plainBody));
req.dockerRequest.end(plainBody);
} else if (!req.readable) {
req.dockerRequest.end();
} else {
req.pipe(req.dockerRequest, { end: true });