Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
914 bytes
|
Line | |
---|
1 | var needle = require('../'),
|
---|
2 | sinon = require('sinon'),
|
---|
3 | should = require('should'),
|
---|
4 | http = require('http'),
|
---|
5 | helpers = require('./helpers');
|
---|
6 |
|
---|
7 | var port = 3456;
|
---|
8 |
|
---|
9 | describe('uri_modifier config parameter function', function() {
|
---|
10 |
|
---|
11 | var server, uri;
|
---|
12 |
|
---|
13 | function send_request(mw, cb) {
|
---|
14 | needle.get(uri, { uri_modifier: mw }, cb);
|
---|
15 | }
|
---|
16 |
|
---|
17 | before(function(done){
|
---|
18 | server = helpers.server({ port: port }, done);
|
---|
19 | })
|
---|
20 |
|
---|
21 | after(function(done) {
|
---|
22 | server.close(done);
|
---|
23 | })
|
---|
24 |
|
---|
25 | describe('modifies uri', function() {
|
---|
26 |
|
---|
27 | var path = '/foo/replace';
|
---|
28 |
|
---|
29 | before(function() {
|
---|
30 | uri = 'localhost:' + port + path
|
---|
31 | });
|
---|
32 |
|
---|
33 | it('should modify path', function(done) {
|
---|
34 | send_request(function(uri) {
|
---|
35 | return uri.replace('/replace', '');
|
---|
36 | }, function(err, res) {
|
---|
37 | should.not.exist(err);
|
---|
38 | should(res.req.path).be.exactly('/foo');
|
---|
39 | done();
|
---|
40 | });
|
---|
41 |
|
---|
42 | });
|
---|
43 |
|
---|
44 | })
|
---|
45 |
|
---|
46 | })
|
---|
Note:
See
TracBrowser
for help on using the repository browser.