2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2016-05-29 03:06:56 -04:00
|
|
|
require('../common');
|
2016-12-30 18:38:06 -05:00
|
|
|
const assert = require('assert');
|
|
|
|
const http = require('http');
|
|
|
|
const url = require('url');
|
2011-10-14 17:10:49 -07:00
|
|
|
|
|
|
|
function check(request) {
|
|
|
|
// a path should come over with params
|
|
|
|
assert.strictEqual(request.url, '/asdf?qwer=zxcv');
|
|
|
|
}
|
|
|
|
|
2017-01-08 13:19:00 +00:00
|
|
|
const server = http.createServer(function(request, response) {
|
2011-10-14 17:10:49 -07:00
|
|
|
// run the check function
|
|
|
|
check.call(this, request, response);
|
|
|
|
response.writeHead(200, {});
|
|
|
|
response.end('ok');
|
|
|
|
server.close();
|
|
|
|
});
|
|
|
|
|
2016-05-29 03:06:56 -04:00
|
|
|
server.listen(0, function() {
|
|
|
|
const port = this.address().port;
|
2017-01-08 13:19:00 +00:00
|
|
|
const testURL = url.parse(`http://localhost:${port}/asdf?qwer=zxcv`);
|
2016-05-29 03:06:56 -04:00
|
|
|
|
2011-10-14 17:10:49 -07:00
|
|
|
// make the request
|
|
|
|
http.request(testURL).end();
|
|
|
|
});
|