You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
914 B
46 lines
914 B
var needle = require('../'),
|
|
sinon = require('sinon'),
|
|
should = require('should'),
|
|
http = require('http'),
|
|
helpers = require('./helpers');
|
|
|
|
var port = 3456;
|
|
|
|
describe('uri_modifier config parameter function', function() {
|
|
|
|
var server, uri;
|
|
|
|
function send_request(mw, cb) {
|
|
needle.get(uri, { uri_modifier: mw }, cb);
|
|
}
|
|
|
|
before(function(done){
|
|
server = helpers.server({ port: port }, done);
|
|
})
|
|
|
|
after(function(done) {
|
|
server.close(done);
|
|
})
|
|
|
|
describe('modifies uri', function() {
|
|
|
|
var path = '/foo/replace';
|
|
|
|
before(function() {
|
|
uri = 'localhost:' + port + path
|
|
});
|
|
|
|
it('should modify path', function(done) {
|
|
send_request(function(uri) {
|
|
return uri.replace('/replace', '');
|
|
}, function(err, res) {
|
|
should.not.exist(err);
|
|
should(res.req.path).be.exactly('/foo');
|
|
done();
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
})
|
|
|