koa-lite/test/context.js

16 lines
406 B
JavaScript
Raw Normal View History

2013-08-17 07:15:57 +00:00
var Context = require('../lib/context');
var request = require('supertest');
2013-08-17 07:15:57 +00:00
var assert = require('assert');
var koa = require('..');
var fs = require('fs');
function context(req, res) {
req = req || { headers: {} };
res = res || { _headers: {} };
res.setHeader = function(k, v){ res._headers[k.toLowerCase()] = v };
var ctx = new Context({}, req, res);
return ctx;
}
module.exports = context;