node-restify icon indicating copy to clipboard operation
node-restify copied to clipboard

Status code 204 with Content-Length waits for timeout

Open mvuherer opened this issue 10 years ago • 2 comments

Restify gets stuck on a response with status code 204 and 'Content-Lenght' header valued higher than 0, eventually times out and executes the callback function.

Example server:

const http = require('http');

const server = http.createServer((req, res) => {
    const body = 'I\'m gonna go ahead and get you stuck for a bit...';
    console.log(body);
    res.writeHead(204, {
        'Content-Length': Buffer.byteLength(body),
        'Content-Type': 'text/plain',
    });
    res.end(body);
});

server.listen(8000, '127.0.0.1', () => {
    console.log(`Server running ...`);
});

Example client:

const restify = require('restify');

const client = restify.createJsonClient({
    url: 'http://localhost:8000'
});

const start = new Date().getTime();
client.del('/', () => {
    console.log('Aaand I\'m done... Took me: ', ((new Date().getTime() - start)/1000), 's');
});

mvuherer avatar Aug 30 '16 14:08 mvuherer

Sorry, but do you mind moving this issue over to: https://github.com/restify/clients/issues?

Thank you!

micahr avatar Aug 30 '16 17:08 micahr

Done!

https://github.com/restify/clients/issues/76

mvuherer avatar Aug 31 '16 06:08 mvuherer