const response = new http.ServerResponse(request); return this.createContext(request, response);
//on stream closed we can end the request archive.on('end', function() { let b = archive.pointer() debug('Archive wrote %d bytes', b) if(!(data.stream instanceof http.ServerResponse)) { return self.ipc.send('archive:notify', user.username, { message: prettyBytes(b) + ' written in '+data.temp, path: p.dirname(data.temp), search: data.name + '.zip' }) } })
archive.on('error', function(err) { archive.abort() if(!(data.stream instanceof http.ServerResponse)) { return self.ipc.send('archive:notify', user.username, {message: err.message, error: true}) } else { return data.stream.status(500).send(err); } })
const res = new http.ServerResponse(req) res.statusCode = 204 res.headers = {
//get http object var getHttp = function(options) { var req = new http.IncomingMessage(); req.headers = { 'host': 'http://127.0.0.1:8033', 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit', }; req.method = 'GET'; req.httpVersion = '1.1'; req.url = '/project/add'; var res = new http.ServerResponse(req); res.write = function() { return true; } return think.http(req, res).then(function(http) { if (options) { for (var key in options) { http[key] = options[key]; } } return http; }) }
testRequest.method = "GET"; testResponse = new http.ServerResponse(testRequest); }); test("we detect it in normal middleware next callback", done => {