You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example demonstrates how the hashing function returns a different hash based on the IncomingMessage's method, path, query string, headers and body.
14
14
15
15
```js
16
-
var hash =require('incoming-message-hash');
17
-
var http =require('http');
16
+
importhashfrom'incoming-message-hash'
17
+
import { createServer } from'http'
18
18
19
-
http.createServer(function(req, res) {
20
-
req.pipe(hash()).pipe(res);
21
-
}).listen(4567, function () {
19
+
createServer((req, res)=> {
20
+
req.pipe(hash()).pipe(res)
21
+
}).listen(4567, () => {
22
22
console.log('Server is listening on port 4567');
23
-
});
23
+
})
24
24
```
25
25
26
26
```bash
@@ -50,16 +50,48 @@ var hash = require('incoming-message-hash');
50
50
51
51
Returns a new [crypto.Hash][] stream using the specified algorithm and encoding (defaults to "md5" and "hex"). You can pipe your [http.IncomingMessage][] in and get a hash back.
Synchronous version of `hash()` that accepts an [http.IncomingMessage][] and its body and returns the hash. You must buffer up the request body yourself if you wish to use this method.
0 commit comments