@@ -15,7 +15,7 @@ Drop-in replacement for Node's `http` and `https` modules that automatically fol
1515``` javascript
1616const { 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
3131const 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:
6161const url = require (' url' );
6262const { http , https } = require (' follow-redirects' );
6363
64- const options = url .parse (' http://bit.ly/900913 ' );
64+ const options = url .parse (' http://en.wikipedia.org/ ' );
6565options .maxRedirects = 10 ;
6666options .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