| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ed26e8e commit a24b8df
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -751,6 +751,27 @@ added: v0.4.0 | |||
| 751 | 751 | ||
| 752 | 752 | * {string} The request path. | |
| 753 | 753 | ||
| 754 | + ### `request.method` | ||
| 755 | + <!-- YAML | ||
| 756 | + added: v0.1.97 | ||
| 757 | + --> | ||
| 758 | + | ||
| 759 | + * {string} The request method. | ||
| 760 | + | ||
| 761 | + ### `request.host` | ||
| 762 | + <!-- YAML | ||
| 763 | + added: REPLACEME | ||
| 764 | + --> | ||
| 765 | + | ||
| 766 | + * {string} The request host. | ||
| 767 | + | ||
| 768 | + ### `request.protocol` | ||
| 769 | + <!-- YAML | ||
| 770 | + added: REPLACEME | ||
| 771 | + --> | ||
| 772 | + | ||
| 773 | + * {string} The request protocol. | ||
| 774 | + | ||
| 754 | 775 | ### `request.removeHeader(name)` | |
| 755 | 776 | <!-- YAML | |
| 756 | 777 | added: v1.6.0 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -221,6 +221,8 @@ function ClientRequest(input, options, cb) { | |||
| 221 | 221 | this.parser = null; | |
| 222 | 222 | this.maxHeadersCount = null; | |
| 223 | 223 | this.reusedSocket = false; | |
| 224 | + this.host = host; | ||
| 225 | + this.protocol = protocol; | ||
| 224 | 226 | ||
| 225 | 227 | let called = false; | |
| 226 | 228 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -51,3 +51,26 @@ const OutgoingMessage = http.OutgoingMessage; | |||
| 51 | 51 | msg.write('asd'); | |
| 52 | 52 | assert.strictEqual(msg.writableLength, 7); | |
| 53 | 53 | } | |
| 54 | + | ||
| 55 | + { | ||
| 56 | + const server = http.createServer((req, res) => { | ||
| 57 | + res.end(); | ||
| 58 | + server.close(); | ||
| 59 | + }); | ||
| 60 | + | ||
| 61 | + server.listen(0); | ||
| 62 | + | ||
| 63 | + server.on('listening', common.mustCall(() => { | ||
| 64 | + const req = http.request({ | ||
| 65 | + port: server.address().port, | ||
| 66 | + method: 'GET', | ||
| 67 | + path: '/' | ||
| 68 | + }); | ||
| 69 | + | ||
| 70 | + assert.strictEqual(req.path, '/'); | ||
| 71 | + assert.strictEqual(req.method, 'GET'); | ||
| 72 | + assert.strictEqual(req.host, 'localhost'); | ||
| 73 | + assert.strictEqual(req.protocol, 'http:'); | ||
| 74 | + req.end(); | ||
| 75 | + })); | ||
| 76 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments