Skip to content

Commit 86dc1f8

Browse files
committed
Sanitizing input.
Fixes #281
1 parent 21ef28a commit 86dc1f8

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Drop-in replacement for Node's `http` and `https` modules that automatically fol
1515
```javascript
1616
const { http, https } = require('follow-redirects');
1717

18-
http.get('http://bit.ly/900913', response => {
18+
http.get('http://en.wikipedia.org/', response => {
1919
response.on('data', chunk => {
2020
console.log(chunk);
2121
});
@@ -29,8 +29,8 @@ If no redirection happened, `responseUrl` is the original request URL.
2929

3030
```javascript
3131
const request = https.request({
32-
host: 'bitly.com',
33-
path: '/UHfDGO',
32+
host: 'en.wikipedia.org',
33+
path: '/',
3434
}, response => {
3535
console.log(response.responseUrl);
3636
// 'http://duckduckgo.com/robots.txt'
@@ -61,7 +61,7 @@ Per-request options are set by passing an `options` object:
6161
const url = require('url');
6262
const { http, https } = require('follow-redirects');
6363

64-
const options = url.parse('http://bit.ly/900913');
64+
const options = url.parse('http://en.wikipedia.org/');
6565
options.maxRedirects = 10;
6666
options.beforeRedirect = (options, response, request) => {
6767
// Use this to adjust the request options upon redirecting,
@@ -74,7 +74,7 @@ options.beforeRedirect = (options, response, request) => {
7474
// request.url = the requested URL that resulted in a redirect
7575
// request.headers = the headers in the request that resulted in a redirect
7676
// request.method = the method of the request that resulted in a redirect
77-
if (options.hostname === "example.com") {
77+
if (options.hostname === "example.org") {
7878
options.auth = "user:password";
7979
}
8080
};

0 commit comments

Comments
 (0)