mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 20:29:36 +00:00

PR-URL: https://github.com/nodejs/node/pull/10550 Reviewed-By: Rich Trott <rtrott@gmail.com>
26 lines
598 B
JavaScript
26 lines
598 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
const url = require('url');
|
|
|
|
function check(request) {
|
|
// a path should come over
|
|
assert.strictEqual(request.url, '/asdf');
|
|
}
|
|
|
|
var server = http.createServer(function(request, response) {
|
|
// run the check function
|
|
check.call(this, request, response);
|
|
response.writeHead(200, {});
|
|
response.end('ok');
|
|
server.close();
|
|
});
|
|
|
|
server.listen(0, function() {
|
|
var testURL = url.parse(`http://localhost:${this.address().port}/asdf`);
|
|
|
|
// make the request
|
|
http.request(testURL).end();
|
|
});
|