diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index ca091a0eb..000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,56 +0,0 @@ - - -### Summary - - -### Simplest Example to Reproduce - - -```js -request({ - method: 'GET', - url: 'http://example.com', // a public URL that we can hit to reproduce, if possible - more: { 'options': 'here' } -}, -``` - -### Expected Behavior - - - - -### Current Behavior - - - -### Possible Solution - - - -### Context - - - -### Your Environment - - -| software | version -| ---------------- | ------- -| request | -| node | -| npm | -| Operating System | diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index ad26df134..000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 365 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 7 -# Issues with these labels will never be considered stale -exemptLabels: - - "Up for consideration" - - greenkeeper - - neverstale - - bug -# Label to use when marking an issue as stale -staleLabel: stale -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 664f38445..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,717 +0,0 @@ -## Change Log - -### v2.88.0 (2018/08/10) -- [#2996](/~https://github.com/cypress-io/request/pull/2996) fix(uuid): import versioned uuid (@kwonoj) -- [#2994](/~https://github.com/cypress-io/request/pull/2994) Update to oauth-sign 0.9.0 (@dlecocq) -- [#2993](/~https://github.com/cypress-io/request/pull/2993) Fix header tests (@simov) -- [#2904](/~https://github.com/cypress-io/request/pull/2904) #515, #2894 Strip port suffix from Host header if the protocol is known. (#2904) (@paambaati) -- [#2791](/~https://github.com/cypress-io/request/pull/2791) Improve AWS SigV4 support. (#2791) (@vikhyat) -- [#2977](/~https://github.com/cypress-io/request/pull/2977) Update test certificates (@simov) - -### v2.87.0 (2018/05/21) -- [#2943](/~https://github.com/cypress-io/request/pull/2943) Replace hawk dependency with a local implemenation (#2943) (@hueniverse) - -### v2.86.0 (2018/05/15) -- [#2885](/~https://github.com/cypress-io/request/pull/2885) Remove redundant code (for Node.js 0.9.4 and below) and dependency (@ChALkeR) -- [#2942](/~https://github.com/cypress-io/request/pull/2942) Make Test GREEN Again! (@simov) -- [#2923](/~https://github.com/cypress-io/request/pull/2923) Alterations for failing CI tests (@gareth-robinson) - -### v2.85.0 (2018/03/12) -- [#2880](/~https://github.com/cypress-io/request/pull/2880) Revert "Update hawk to 7.0.7 (#2880)" (@simov) - -### v2.84.0 (2018/03/12) -- [#2793](/~https://github.com/cypress-io/request/pull/2793) Fixed calculation of oauth_body_hash, issue #2792 (@dvishniakov) -- [#2880](/~https://github.com/cypress-io/request/pull/2880) Update hawk to 7.0.7 (#2880) (@kornel-kedzierski) - -### v2.83.0 (2017/09/27) -- [#2776](/~https://github.com/cypress-io/request/pull/2776) Updating tough-cookie due to security fix. (#2776) (@karlnorling) - -### v2.82.0 (2017/09/19) -- [#2703](/~https://github.com/cypress-io/request/pull/2703) Add Node.js v8 to Travis CI (@ryysud) -- [#2751](/~https://github.com/cypress-io/request/pull/2751) Update of hawk and qs to latest version (#2751) (@Olivier-Moreau) -- [#2658](/~https://github.com/cypress-io/request/pull/2658) Fixed some text in README.md (#2658) (@Marketionist) -- [#2635](/~https://github.com/cypress-io/request/pull/2635) chore(package): update aws-sign2 to version 0.7.0 (#2635) (@greenkeeperio-bot) -- [#2641](/~https://github.com/cypress-io/request/pull/2641) Update README to simplify & update convenience methods (#2641) (@FredKSchott) -- [#2541](/~https://github.com/cypress-io/request/pull/2541) Add convenience method for HTTP OPTIONS (#2541) (@jamesseanwright) -- [#2605](/~https://github.com/cypress-io/request/pull/2605) Add promise support section to README (#2605) (@FredKSchott) -- [#2579](/~https://github.com/cypress-io/request/pull/2579) refactor(lint): replace eslint with standard (#2579) (@ahmadnassri) -- [#2598](/~https://github.com/cypress-io/request/pull/2598) Update codecov to version 2.0.2 πŸš€ (@greenkeeperio-bot) -- [#2590](/~https://github.com/cypress-io/request/pull/2590) Adds test-timing keepAlive test (@nicjansma) -- [#2589](/~https://github.com/cypress-io/request/pull/2589) fix tabulation on request example README.MD (@odykyi) -- [#2594](/~https://github.com/cypress-io/request/pull/2594) chore(dependencies): har-validator to 5.x [removes babel dep] (@ahmadnassri) - -### v2.81.0 (2017/03/09) -- [#2584](/~https://github.com/cypress-io/request/pull/2584) Security issue: Upgrade qs to version 6.4.0 (@sergejmueller) -- [#2578](/~https://github.com/cypress-io/request/pull/2578) safe-buffer doesn't zero-fill by default, its just a polyfill. (#2578) (@mikeal) -- [#2566](/~https://github.com/cypress-io/request/pull/2566) Timings: Tracks 'lookup', adds 'wait' time, fixes connection re-use (#2566) (@nicjansma) -- [#2574](/~https://github.com/cypress-io/request/pull/2574) Migrating to safe-buffer for improved security. (@mikeal) -- [#2573](/~https://github.com/cypress-io/request/pull/2573) fixes #2572 (@ahmadnassri) - -### v2.80.0 (2017/03/04) -- [#2571](/~https://github.com/cypress-io/request/pull/2571) Correctly format the Host header for IPv6 addresses (@JamesMGreene) -- [#2558](/~https://github.com/cypress-io/request/pull/2558) Update README.md example snippet (@FredKSchott) -- [#2221](/~https://github.com/cypress-io/request/pull/2221) Adding a simple Response object reference in argument specification (@calamarico) -- [#2452](/~https://github.com/cypress-io/request/pull/2452) Adds .timings array with DNC, TCP, request and response times (@nicjansma) -- [#2553](/~https://github.com/cypress-io/request/pull/2553) add ISSUE_TEMPLATE, move PR template (@FredKSchott) -- [#2539](/~https://github.com/cypress-io/request/pull/2539) Create PULL_REQUEST_TEMPLATE.md (@FredKSchott) -- [#2524](/~https://github.com/cypress-io/request/pull/2524) Update caseless to version 0.12.0 πŸš€ (@greenkeeperio-bot) -- [#2460](/~https://github.com/cypress-io/request/pull/2460) Fix wrong MIME type in example (@OwnageIsMagic) -- [#2514](/~https://github.com/cypress-io/request/pull/2514) Change tags to keywords in package.json (@humphd) -- [#2492](/~https://github.com/cypress-io/request/pull/2492) More lenient gzip decompression (@addaleax) - -### v2.79.0 (2016/11/18) -- [#2368](/~https://github.com/cypress-io/request/pull/2368) Fix typeof check in test-pool.js (@forivall) -- [#2394](/~https://github.com/cypress-io/request/pull/2394) Use `files` in package.json (@SimenB) -- [#2463](/~https://github.com/cypress-io/request/pull/2463) AWS support for session tokens for temporary credentials (@simov) -- [#2467](/~https://github.com/cypress-io/request/pull/2467) Migrate to uuid (@simov, @antialias) -- [#2459](/~https://github.com/cypress-io/request/pull/2459) Update taper to version 0.5.0 πŸš€ (@greenkeeperio-bot) -- [#2448](/~https://github.com/cypress-io/request/pull/2448) Make other connect timeout test more reliable too (@mscdex) - -### v2.78.0 (2016/11/03) -- [#2447](/~https://github.com/cypress-io/request/pull/2447) Always set request timeout on keep-alive connections (@mscdex) - -### v2.77.0 (2016/11/03) -- [#2439](/~https://github.com/cypress-io/request/pull/2439) Fix socket 'connect' listener handling (@mscdex) -- [#2442](/~https://github.com/cypress-io/request/pull/2442) πŸ‘»πŸ˜± Node.js 0.10 is unmaintained πŸ˜±πŸ‘» (@greenkeeperio-bot) -- [#2435](/~https://github.com/cypress-io/request/pull/2435) Add followOriginalHttpMethod to redirect to original HTTP method (@kirrg001) -- [#2414](/~https://github.com/cypress-io/request/pull/2414) Improve test-timeout reliability (@mscdex) - -### v2.76.0 (2016/10/25) -- [#2424](/~https://github.com/cypress-io/request/pull/2424) Handle buffers directly instead of using "bl" (@zertosh) -- [#2415](/~https://github.com/cypress-io/request/pull/2415) Re-enable timeout tests on Travis + other fixes (@mscdex) -- [#2431](/~https://github.com/cypress-io/request/pull/2431) Improve timeouts accuracy and node v6.8.0+ compatibility (@mscdex, @greenkeeperio-bot) -- [#2428](/~https://github.com/cypress-io/request/pull/2428) Update qs to version 6.3.0 πŸš€ (@greenkeeperio-bot) -- [#2420](/~https://github.com/cypress-io/request/pull/2420) change .on to .once, remove possible memory leaks (@duereg) -- [#2426](/~https://github.com/cypress-io/request/pull/2426) Remove "isFunction" helper in favor of "typeof" check (@zertosh) -- [#2425](/~https://github.com/cypress-io/request/pull/2425) Simplify "defer" helper creation (@zertosh) -- [#2402](/~https://github.com/cypress-io/request/pull/2402) form-data@2.1.1 breaks build 🚨 (@greenkeeperio-bot) -- [#2393](/~https://github.com/cypress-io/request/pull/2393) Update form-data to version 2.1.0 πŸš€ (@greenkeeperio-bot) - -### v2.75.0 (2016/09/17) -- [#2381](/~https://github.com/cypress-io/request/pull/2381) Drop support for Node 0.10 (@simov) -- [#2377](/~https://github.com/cypress-io/request/pull/2377) Update form-data to version 2.0.0 πŸš€ (@greenkeeperio-bot) -- [#2353](/~https://github.com/cypress-io/request/pull/2353) Add greenkeeper ignored packages (@simov) -- [#2351](/~https://github.com/cypress-io/request/pull/2351) Update karma-tap to version 3.0.1 πŸš€ (@greenkeeperio-bot) -- [#2348](/~https://github.com/cypress-io/request/pull/2348) form-data@1.0.1 breaks build 🚨 (@greenkeeperio-bot) -- [#2349](/~https://github.com/cypress-io/request/pull/2349) Check error type instead of string (@scotttrinh) - -### v2.74.0 (2016/07/22) -- [#2295](/~https://github.com/cypress-io/request/pull/2295) Update tough-cookie to 2.3.0 (@stash-sfdc) -- [#2280](/~https://github.com/cypress-io/request/pull/2280) Update karma-tap to version 2.0.1 πŸš€ (@greenkeeperio-bot) - -### v2.73.0 (2016/07/09) -- [#2240](/~https://github.com/cypress-io/request/pull/2240) Remove connectionErrorHandler to fix #1903 (@zarenner) -- [#2251](/~https://github.com/cypress-io/request/pull/2251) tape@4.6.0 breaks build 🚨 (@greenkeeperio-bot) -- [#2225](/~https://github.com/cypress-io/request/pull/2225) Update docs (@ArtskydJ) -- [#2203](/~https://github.com/cypress-io/request/pull/2203) Update browserify to version 13.0.1 πŸš€ (@greenkeeperio-bot) -- [#2275](/~https://github.com/cypress-io/request/pull/2275) Update karma to version 1.1.1 πŸš€ (@greenkeeperio-bot) -- [#2204](/~https://github.com/cypress-io/request/pull/2204) Add codecov.yml and disable PR comments (@simov) -- [#2212](/~https://github.com/cypress-io/request/pull/2212) Fix link to http.IncomingMessage documentation (@nazieb) -- [#2208](/~https://github.com/cypress-io/request/pull/2208) Update to form-data RC4 and pass null values to it (@simov) -- [#2207](/~https://github.com/cypress-io/request/pull/2207) Move aws4 require statement to the top (@simov) -- [#2199](/~https://github.com/cypress-io/request/pull/2199) Update karma-coverage to version 1.0.0 πŸš€ (@greenkeeperio-bot) -- [#2206](/~https://github.com/cypress-io/request/pull/2206) Update qs to version 6.2.0 πŸš€ (@greenkeeperio-bot) -- [#2205](/~https://github.com/cypress-io/request/pull/2205) Use server-destory to close hanging sockets in tests (@simov) -- [#2200](/~https://github.com/cypress-io/request/pull/2200) Update karma-cli to version 1.0.0 πŸš€ (@greenkeeperio-bot) - -### v2.72.0 (2016/04/17) -- [#2176](/~https://github.com/cypress-io/request/pull/2176) Do not try to pipe Gzip responses with no body (@simov) -- [#2175](/~https://github.com/cypress-io/request/pull/2175) Add 'delete' alias for the 'del' API method (@simov, @MuhanZou) -- [#2172](/~https://github.com/cypress-io/request/pull/2172) Add support for deflate content encoding (@czardoz) -- [#2169](/~https://github.com/cypress-io/request/pull/2169) Add callback option (@simov) -- [#2165](/~https://github.com/cypress-io/request/pull/2165) Check for self.req existence inside the write method (@simov) -- [#2167](/~https://github.com/cypress-io/request/pull/2167) Fix TravisCI badge reference master branch (@a0viedo) - -### v2.71.0 (2016/04/12) -- [#2164](/~https://github.com/cypress-io/request/pull/2164) Catch errors from the underlying http module (@simov) - -### v2.70.0 (2016/04/05) -- [#2147](/~https://github.com/cypress-io/request/pull/2147) Update eslint to version 2.5.3 πŸš€ (@simov, @greenkeeperio-bot) -- [#2009](/~https://github.com/cypress-io/request/pull/2009) Support JSON stringify replacer argument. (@elyobo) -- [#2142](/~https://github.com/cypress-io/request/pull/2142) Update eslint to version 2.5.1 πŸš€ (@greenkeeperio-bot) -- [#2128](/~https://github.com/cypress-io/request/pull/2128) Update browserify-istanbul to version 2.0.0 πŸš€ (@greenkeeperio-bot) -- [#2115](/~https://github.com/cypress-io/request/pull/2115) Update eslint to version 2.3.0 πŸš€ (@simov, @greenkeeperio-bot) -- [#2089](/~https://github.com/cypress-io/request/pull/2089) Fix badges (@simov) -- [#2092](/~https://github.com/cypress-io/request/pull/2092) Update browserify-istanbul to version 1.0.0 πŸš€ (@greenkeeperio-bot) -- [#2079](/~https://github.com/cypress-io/request/pull/2079) Accept read stream as body option (@simov) -- [#2070](/~https://github.com/cypress-io/request/pull/2070) Update bl to version 1.1.2 πŸš€ (@greenkeeperio-bot) -- [#2063](/~https://github.com/cypress-io/request/pull/2063) Up bluebird and oauth-sign (@simov) -- [#2058](/~https://github.com/cypress-io/request/pull/2058) Karma fixes for latest versions (@eiriksm) -- [#2057](/~https://github.com/cypress-io/request/pull/2057) Update contributing guidelines (@simov) -- [#2054](/~https://github.com/cypress-io/request/pull/2054) Update qs to version 6.1.0 πŸš€ (@greenkeeperio-bot) - -### v2.69.0 (2016/01/27) -- [#2041](/~https://github.com/cypress-io/request/pull/2041) restore aws4 as regular dependency (@rmg) - -### v2.68.0 (2016/01/27) -- [#2036](/~https://github.com/cypress-io/request/pull/2036) Add AWS Signature Version 4 (@simov, @mirkods) -- [#2022](/~https://github.com/cypress-io/request/pull/2022) Convert numeric multipart bodies to string (@simov, @feross) -- [#2024](/~https://github.com/cypress-io/request/pull/2024) Update har-validator dependency for nsp advisory #76 (@TylerDixon) -- [#2016](/~https://github.com/cypress-io/request/pull/2016) Update qs to version 6.0.2 πŸš€ (@greenkeeperio-bot) -- [#2007](/~https://github.com/cypress-io/request/pull/2007) Use the `extend` module instead of util._extend (@simov) -- [#2003](/~https://github.com/cypress-io/request/pull/2003) Update browserify to version 13.0.0 πŸš€ (@greenkeeperio-bot) -- [#1989](/~https://github.com/cypress-io/request/pull/1989) Update buffer-equal to version 1.0.0 πŸš€ (@greenkeeperio-bot) -- [#1956](/~https://github.com/cypress-io/request/pull/1956) Check form-data content-length value before setting up the header (@jongyoonlee) -- [#1958](/~https://github.com/cypress-io/request/pull/1958) Use IncomingMessage.destroy method (@simov) -- [#1952](/~https://github.com/cypress-io/request/pull/1952) Adds example for Tor proxy (@prometheansacrifice) -- [#1943](/~https://github.com/cypress-io/request/pull/1943) Update eslint to version 1.10.3 πŸš€ (@simov, @greenkeeperio-bot) -- [#1924](/~https://github.com/cypress-io/request/pull/1924) Update eslint to version 1.10.1 πŸš€ (@greenkeeperio-bot) -- [#1915](/~https://github.com/cypress-io/request/pull/1915) Remove content-length and transfer-encoding headers from defaultProxyHeaderWhiteList (@yaxia) - -### v2.67.0 (2015/11/19) -- [#1913](/~https://github.com/cypress-io/request/pull/1913) Update http-signature to version 1.1.0 πŸš€ (@greenkeeperio-bot) - -### v2.66.0 (2015/11/18) -- [#1906](/~https://github.com/cypress-io/request/pull/1906) Update README URLs based on HTTP redirects (@ReadmeCritic) -- [#1905](/~https://github.com/cypress-io/request/pull/1905) Convert typed arrays into regular buffers (@simov) -- [#1902](/~https://github.com/cypress-io/request/pull/1902) node-uuid@1.4.7 breaks build 🚨 (@greenkeeperio-bot) -- [#1894](/~https://github.com/cypress-io/request/pull/1894) Fix tunneling after redirection from https (Original: #1881) (@simov, @falms) -- [#1893](/~https://github.com/cypress-io/request/pull/1893) Update eslint to version 1.9.0 πŸš€ (@greenkeeperio-bot) -- [#1852](/~https://github.com/cypress-io/request/pull/1852) Update eslint to version 1.7.3 πŸš€ (@simov, @greenkeeperio-bot, @paulomcnally, @michelsalib, @arbaaz, @nsklkn, @LoicMahieu, @JoshWillik, @jzaefferer, @ryanwholey, @djchie, @thisconnect, @mgenereu, @acroca, @Sebmaster, @KoltesDigital) -- [#1876](/~https://github.com/cypress-io/request/pull/1876) Implement loose matching for har mime types (@simov) -- [#1875](/~https://github.com/cypress-io/request/pull/1875) Update bluebird to version 3.0.2 πŸš€ (@simov, @greenkeeperio-bot) -- [#1871](/~https://github.com/cypress-io/request/pull/1871) Update browserify to version 12.0.1 πŸš€ (@greenkeeperio-bot) -- [#1866](/~https://github.com/cypress-io/request/pull/1866) Add missing quotes on x-token property in README (@miguelmota) -- [#1874](/~https://github.com/cypress-io/request/pull/1874) Fix typo in README.md (@gswalden) -- [#1860](/~https://github.com/cypress-io/request/pull/1860) Improve referer header tests and docs (@simov) -- [#1861](/~https://github.com/cypress-io/request/pull/1861) Remove redundant call to Stream constructor (@watson) -- [#1857](/~https://github.com/cypress-io/request/pull/1857) Fix Referer header to point to the original host name (@simov) -- [#1850](/~https://github.com/cypress-io/request/pull/1850) Update karma-coverage to version 0.5.3 πŸš€ (@greenkeeperio-bot) -- [#1847](/~https://github.com/cypress-io/request/pull/1847) Use node's latest version when building (@simov) -- [#1836](/~https://github.com/cypress-io/request/pull/1836) Tunnel: fix wrong property name (@KoltesDigital) -- [#1820](/~https://github.com/cypress-io/request/pull/1820) Set href as request.js uses it (@mgenereu) -- [#1840](/~https://github.com/cypress-io/request/pull/1840) Update http-signature to version 1.0.2 πŸš€ (@greenkeeperio-bot) -- [#1845](/~https://github.com/cypress-io/request/pull/1845) Update istanbul to version 0.4.0 πŸš€ (@greenkeeperio-bot) - -### v2.65.0 (2015/10/11) -- [#1833](/~https://github.com/cypress-io/request/pull/1833) Update aws-sign2 to version 0.6.0 πŸš€ (@greenkeeperio-bot) -- [#1811](/~https://github.com/cypress-io/request/pull/1811) Enable loose cookie parsing in tough-cookie (@Sebmaster) -- [#1830](/~https://github.com/cypress-io/request/pull/1830) Bring back tilde ranges for all dependencies (@simov) -- [#1821](/~https://github.com/cypress-io/request/pull/1821) Implement support for RFC 2617 MD5-sess algorithm. (@BigDSK) -- [#1828](/~https://github.com/cypress-io/request/pull/1828) Updated qs dependency to 5.2.0 (@acroca) -- [#1818](/~https://github.com/cypress-io/request/pull/1818) Extract `readResponseBody` method out of `onRequestResponse` (@pvoisin) -- [#1819](/~https://github.com/cypress-io/request/pull/1819) Run stringify once (@mgenereu) -- [#1814](/~https://github.com/cypress-io/request/pull/1814) Updated har-validator to version 2.0.2 (@greenkeeperio-bot) -- [#1807](/~https://github.com/cypress-io/request/pull/1807) Updated tough-cookie to version 2.1.0 (@greenkeeperio-bot) -- [#1800](/~https://github.com/cypress-io/request/pull/1800) Add caret ranges for devDependencies, except eslint (@simov) -- [#1799](/~https://github.com/cypress-io/request/pull/1799) Updated karma-browserify to version 4.4.0 (@greenkeeperio-bot) -- [#1797](/~https://github.com/cypress-io/request/pull/1797) Updated tape to version 4.2.0 (@greenkeeperio-bot) -- [#1788](/~https://github.com/cypress-io/request/pull/1788) Pinned all dependencies (@greenkeeperio-bot) - -### v2.64.0 (2015/09/25) -- [#1787](/~https://github.com/cypress-io/request/pull/1787) npm ignore examples, release.sh and disabled.appveyor.yml (@thisconnect) -- [#1775](/~https://github.com/cypress-io/request/pull/1775) Fix typo in README.md (@djchie) -- [#1776](/~https://github.com/cypress-io/request/pull/1776) Changed word 'conjuction' to read 'conjunction' in README.md (@ryanwholey) -- [#1785](/~https://github.com/cypress-io/request/pull/1785) Revert: Set default application/json content-type when using json option #1772 (@simov) - -### v2.63.0 (2015/09/21) -- [#1772](/~https://github.com/cypress-io/request/pull/1772) Set default application/json content-type when using json option (@jzaefferer) - -### v2.62.0 (2015/09/15) -- [#1768](/~https://github.com/cypress-io/request/pull/1768) Add node 4.0 to the list of build targets (@simov) -- [#1767](/~https://github.com/cypress-io/request/pull/1767) Query strings now cooperate with unix sockets (@JoshWillik) -- [#1750](/~https://github.com/cypress-io/request/pull/1750) Revert doc about installation of tough-cookie added in #884 (@LoicMahieu) -- [#1746](/~https://github.com/cypress-io/request/pull/1746) Missed comma in Readme (@nsklkn) -- [#1743](/~https://github.com/cypress-io/request/pull/1743) Fix options not being initialized in defaults method (@simov) - -### v2.61.0 (2015/08/19) -- [#1721](/~https://github.com/cypress-io/request/pull/1721) Minor fix in README.md (@arbaaz) -- [#1733](/~https://github.com/cypress-io/request/pull/1733) Avoid useless Buffer transformation (@michelsalib) -- [#1726](/~https://github.com/cypress-io/request/pull/1726) Update README.md (@paulomcnally) -- [#1715](/~https://github.com/cypress-io/request/pull/1715) Fix forever option in node > 0.10 #1709 (@calibr) -- [#1716](/~https://github.com/cypress-io/request/pull/1716) Do not create Buffer from Object in setContentLength(iojs v3.0 issue) (@calibr) -- [#1711](/~https://github.com/cypress-io/request/pull/1711) Add ability to detect connect timeouts (@kevinburke) -- [#1712](/~https://github.com/cypress-io/request/pull/1712) Set certificate expiration to August 2, 2018 (@kevinburke) -- [#1700](/~https://github.com/cypress-io/request/pull/1700) debug() when JSON.parse() on a response body fails (@phillipj) - -### v2.60.0 (2015/07/21) -- [#1687](/~https://github.com/cypress-io/request/pull/1687) Fix caseless bug - content-type not being set for multipart/form-data (@simov, @garymathews) - -### v2.59.0 (2015/07/20) -- [#1671](/~https://github.com/cypress-io/request/pull/1671) Add tests and docs for using the agent, agentClass, agentOptions and forever options. - Forever option defaults to using http(s).Agent in node 0.12+ (@simov) -- [#1679](/~https://github.com/cypress-io/request/pull/1679) Fix - do not remove OAuth param when using OAuth realm (@simov, @jhalickman) -- [#1668](/~https://github.com/cypress-io/request/pull/1668) updated dependencies (@deamme) -- [#1656](/~https://github.com/cypress-io/request/pull/1656) Fix form method (@simov) -- [#1651](/~https://github.com/cypress-io/request/pull/1651) Preserve HEAD method when using followAllRedirects (@simov) -- [#1652](/~https://github.com/cypress-io/request/pull/1652) Update `encoding` option documentation in README.md (@daniel347x) -- [#1650](/~https://github.com/cypress-io/request/pull/1650) Allow content-type overriding when using the `form` option (@simov) -- [#1646](/~https://github.com/cypress-io/request/pull/1646) Clarify the nature of setting `ca` in `agentOptions` (@jeffcharles) - -### v2.58.0 (2015/06/16) -- [#1638](/~https://github.com/cypress-io/request/pull/1638) Use the `extend` module to deep extend in the defaults method (@simov) -- [#1631](/~https://github.com/cypress-io/request/pull/1631) Move tunnel logic into separate module (@simov) -- [#1634](/~https://github.com/cypress-io/request/pull/1634) Fix OAuth query transport_method (@simov) -- [#1603](/~https://github.com/cypress-io/request/pull/1603) Add codecov (@simov) - -### v2.57.0 (2015/05/31) -- [#1615](/~https://github.com/cypress-io/request/pull/1615) Replace '.client' with '.socket' as the former was deprecated in 2.2.0. (@ChALkeR) - -### v2.56.0 (2015/05/28) -- [#1610](/~https://github.com/cypress-io/request/pull/1610) Bump module dependencies (@simov) -- [#1600](/~https://github.com/cypress-io/request/pull/1600) Extract the querystring logic into separate module (@simov) -- [#1607](/~https://github.com/cypress-io/request/pull/1607) Re-generate certificates (@simov) -- [#1599](/~https://github.com/cypress-io/request/pull/1599) Move getProxyFromURI logic below the check for Invaild URI (#1595) (@simov) -- [#1598](/~https://github.com/cypress-io/request/pull/1598) Fix the way http verbs are defined in order to please intellisense IDEs (@simov, @flannelJesus) -- [#1591](/~https://github.com/cypress-io/request/pull/1591) A few minor fixes: (@simov) -- [#1584](/~https://github.com/cypress-io/request/pull/1584) Refactor test-default tests (according to comments in #1430) (@simov) -- [#1585](/~https://github.com/cypress-io/request/pull/1585) Fixing documentation regarding TLS options (#1583) (@mainakae) -- [#1574](/~https://github.com/cypress-io/request/pull/1574) Refresh the oauth_nonce on redirect (#1573) (@simov) -- [#1570](/~https://github.com/cypress-io/request/pull/1570) Discovered tests that weren't properly running (@seanstrom) -- [#1569](/~https://github.com/cypress-io/request/pull/1569) Fix pause before response arrives (@kevinoid) -- [#1558](/~https://github.com/cypress-io/request/pull/1558) Emit error instead of throw (@simov) -- [#1568](/~https://github.com/cypress-io/request/pull/1568) Fix stall when piping gzipped response (@kevinoid) -- [#1560](/~https://github.com/cypress-io/request/pull/1560) Update combined-stream (@apechimp) -- [#1543](/~https://github.com/cypress-io/request/pull/1543) Initial support for oauth_body_hash on json payloads (@simov, @aesopwolf) -- [#1541](/~https://github.com/cypress-io/request/pull/1541) Fix coveralls (@simov) -- [#1540](/~https://github.com/cypress-io/request/pull/1540) Fix recursive defaults for convenience methods (@simov) -- [#1536](/~https://github.com/cypress-io/request/pull/1536) More eslint style rules (@froatsnook) -- [#1533](/~https://github.com/cypress-io/request/pull/1533) Adding dependency status bar to README.md (@YasharF) -- [#1539](/~https://github.com/cypress-io/request/pull/1539) ensure the latest version of har-validator is included (@ahmadnassri) -- [#1516](/~https://github.com/cypress-io/request/pull/1516) forever+pool test (@devTristan) - -### v2.55.0 (2015/04/05) -- [#1520](/~https://github.com/cypress-io/request/pull/1520) Refactor defaults (@simov) -- [#1525](/~https://github.com/cypress-io/request/pull/1525) Delete request headers with undefined value. (@froatsnook) -- [#1521](/~https://github.com/cypress-io/request/pull/1521) Add promise tests (@simov) -- [#1518](/~https://github.com/cypress-io/request/pull/1518) Fix defaults (@simov) -- [#1515](/~https://github.com/cypress-io/request/pull/1515) Allow static invoking of convenience methods (@simov) -- [#1505](/~https://github.com/cypress-io/request/pull/1505) Fix multipart boundary extraction regexp (@simov) -- [#1510](/~https://github.com/cypress-io/request/pull/1510) Fix basic auth form data (@simov) - -### v2.54.0 (2015/03/24) -- [#1501](/~https://github.com/cypress-io/request/pull/1501) HTTP Archive 1.2 support (@ahmadnassri) -- [#1486](/~https://github.com/cypress-io/request/pull/1486) Add a test for the forever agent (@akshayp) -- [#1500](/~https://github.com/cypress-io/request/pull/1500) Adding handling for no auth method and null bearer (@philberg) -- [#1498](/~https://github.com/cypress-io/request/pull/1498) Add table of contents in readme (@simov) -- [#1477](/~https://github.com/cypress-io/request/pull/1477) Add support for qs options via qsOptions key (@simov) -- [#1496](/~https://github.com/cypress-io/request/pull/1496) Parameters encoded to base 64 should be decoded as UTF-8, not ASCII. (@albanm) -- [#1494](/~https://github.com/cypress-io/request/pull/1494) Update eslint (@froatsnook) -- [#1474](/~https://github.com/cypress-io/request/pull/1474) Require Colon in Basic Auth (@erykwalder) -- [#1481](/~https://github.com/cypress-io/request/pull/1481) Fix baseUrl and redirections. (@burningtree) -- [#1469](/~https://github.com/cypress-io/request/pull/1469) Feature/base url (@froatsnook) -- [#1459](/~https://github.com/cypress-io/request/pull/1459) Add option to time request/response cycle (including rollup of redirects) (@aaron-em) -- [#1468](/~https://github.com/cypress-io/request/pull/1468) Re-enable io.js/node 0.12 build (@simov, @mikeal, @BBB) -- [#1442](/~https://github.com/cypress-io/request/pull/1442) Fixed the issue with strictSSL tests on 0.12 & io.js by explicitly setting a cipher that matches the cert. (@BBB, @nickmccurdy, @demohi, @simov, @0x4139) -- [#1460](/~https://github.com/cypress-io/request/pull/1460) localAddress or proxy config is lost when redirecting (@simov, @0x4139) -- [#1453](/~https://github.com/cypress-io/request/pull/1453) Test on Node.js 0.12 and io.js with allowed failures (@nickmccurdy, @demohi) -- [#1426](/~https://github.com/cypress-io/request/pull/1426) Fixing tests to pass on io.js and node 0.12 (only test-https.js stiff failing) (@mikeal) -- [#1446](/~https://github.com/cypress-io/request/pull/1446) Missing HTTP referer header with redirects Fixes #1038 (@simov, @guimon) -- [#1428](/~https://github.com/cypress-io/request/pull/1428) Deprecate Node v0.8.x (@nylen) -- [#1436](/~https://github.com/cypress-io/request/pull/1436) Add ability to set a requester without setting default options (@tikotzky) -- [#1435](/~https://github.com/cypress-io/request/pull/1435) dry up verb methods (@sethpollack) -- [#1423](/~https://github.com/cypress-io/request/pull/1423) Allow fully qualified multipart content-type header (@simov) -- [#1430](/~https://github.com/cypress-io/request/pull/1430) Fix recursive requester (@tikotzky) -- [#1429](/~https://github.com/cypress-io/request/pull/1429) Throw error when making HEAD request with a body (@tikotzky) -- [#1419](/~https://github.com/cypress-io/request/pull/1419) Add note that the project is broken in 0.12.x (@nylen) -- [#1413](/~https://github.com/cypress-io/request/pull/1413) Fix basic auth (@simov) -- [#1397](/~https://github.com/cypress-io/request/pull/1397) Improve pipe-from-file tests (@nylen) - -### v2.53.0 (2015/02/02) -- [#1396](/~https://github.com/cypress-io/request/pull/1396) Do not rfc3986 escape JSON bodies (@nylen, @simov) -- [#1392](/~https://github.com/cypress-io/request/pull/1392) Improve `timeout` option description (@watson) - -### v2.52.0 (2015/02/02) -- [#1383](/~https://github.com/cypress-io/request/pull/1383) Add missing HTTPS options that were not being passed to tunnel (@brichard19) (@nylen) -- [#1388](/~https://github.com/cypress-io/request/pull/1388) Upgrade mime-types package version (@roderickhsiao) -- [#1389](/~https://github.com/cypress-io/request/pull/1389) Revise Setup Tunnel Function (@seanstrom) -- [#1374](/~https://github.com/cypress-io/request/pull/1374) Allow explicitly disabling tunneling for proxied https destinations (@nylen) -- [#1376](/~https://github.com/cypress-io/request/pull/1376) Use karma-browserify for tests. Add browser test coverage reporter. (@eiriksm) -- [#1366](/~https://github.com/cypress-io/request/pull/1366) Refactor OAuth into separate module (@simov) -- [#1373](/~https://github.com/cypress-io/request/pull/1373) Rewrite tunnel test to be pure Node.js (@nylen) -- [#1371](/~https://github.com/cypress-io/request/pull/1371) Upgrade test reporter (@nylen) -- [#1360](/~https://github.com/cypress-io/request/pull/1360) Refactor basic, bearer, digest auth logic into separate class (@simov) -- [#1354](/~https://github.com/cypress-io/request/pull/1354) Remove circular dependency from debugging code (@nylen) -- [#1351](/~https://github.com/cypress-io/request/pull/1351) Move digest auth into private prototype method (@simov) -- [#1352](/~https://github.com/cypress-io/request/pull/1352) Update hawk dependency to ~2.3.0 (@mridgway) -- [#1353](/~https://github.com/cypress-io/request/pull/1353) Correct travis-ci badge (@dogancelik) -- [#1349](/~https://github.com/cypress-io/request/pull/1349) Make sure we return on errored browser requests. (@eiriksm) -- [#1346](/~https://github.com/cypress-io/request/pull/1346) getProxyFromURI Extraction Refactor (@seanstrom) -- [#1337](/~https://github.com/cypress-io/request/pull/1337) Standardize test ports on 6767 (@nylen) -- [#1341](/~https://github.com/cypress-io/request/pull/1341) Emit FormData error events as Request error events (@nylen, @rwky) -- [#1343](/~https://github.com/cypress-io/request/pull/1343) Clean up readme badges, and add Travis and Coveralls badges (@nylen) -- [#1345](/~https://github.com/cypress-io/request/pull/1345) Update README.md (@Aaron-Hartwig) -- [#1338](/~https://github.com/cypress-io/request/pull/1338) Always wait for server.close() callback in tests (@nylen) -- [#1342](/~https://github.com/cypress-io/request/pull/1342) Add mock https server and redo start of browser tests for this purpose. (@eiriksm) -- [#1339](/~https://github.com/cypress-io/request/pull/1339) Improve auth docs (@nylen) -- [#1335](/~https://github.com/cypress-io/request/pull/1335) Add support for OAuth plaintext signature method (@simov) -- [#1332](/~https://github.com/cypress-io/request/pull/1332) Add clean script to remove test-browser.js after the tests run (@seanstrom) -- [#1327](/~https://github.com/cypress-io/request/pull/1327) Fix errors generating coverage reports. (@nylen) -- [#1330](/~https://github.com/cypress-io/request/pull/1330) Return empty buffer upon empty response body and encoding is set to null (@seanstrom) -- [#1326](/~https://github.com/cypress-io/request/pull/1326) Use faster container-based infrastructure on Travis (@nylen) -- [#1315](/~https://github.com/cypress-io/request/pull/1315) Implement rfc3986 option (@simov, @nylen, @apoco, @DullReferenceException, @mmalecki, @oliamb, @cliffcrosland, @LewisJEllis, @eiriksm, @poislagarde) -- [#1314](/~https://github.com/cypress-io/request/pull/1314) Detect urlencoded form data header via regex (@simov) -- [#1317](/~https://github.com/cypress-io/request/pull/1317) Improve OAuth1.0 server side flow example (@simov) - -### v2.51.0 (2014/12/10) -- [#1310](/~https://github.com/cypress-io/request/pull/1310) Revert changes introduced in /~https://github.com/cypress-io/request/pull/1282 (@simov) - -### v2.50.0 (2014/12/09) -- [#1308](/~https://github.com/cypress-io/request/pull/1308) Add browser test to keep track of browserify compability. (@eiriksm) -- [#1299](/~https://github.com/cypress-io/request/pull/1299) Add optional support for jsonReviver (@poislagarde) -- [#1277](/~https://github.com/cypress-io/request/pull/1277) Add Coveralls configuration (@simov) -- [#1307](/~https://github.com/cypress-io/request/pull/1307) Upgrade form-data, add back browserify compability. Fixes #455. (@eiriksm) -- [#1305](/~https://github.com/cypress-io/request/pull/1305) Fix typo in README.md (@LewisJEllis) -- [#1288](/~https://github.com/cypress-io/request/pull/1288) Update README.md to explain custom file use case (@cliffcrosland) - -### v2.49.0 (2014/11/28) -- [#1295](/~https://github.com/cypress-io/request/pull/1295) fix(proxy): no-proxy false positive (@oliamb) -- [#1292](/~https://github.com/cypress-io/request/pull/1292) Upgrade `caseless` to 0.8.1 (@mmalecki) -- [#1276](/~https://github.com/cypress-io/request/pull/1276) Set transfer encoding for multipart/related to chunked by default (@simov) -- [#1275](/~https://github.com/cypress-io/request/pull/1275) Fix multipart content-type headers detection (@simov) -- [#1269](/~https://github.com/cypress-io/request/pull/1269) adds streams example for review (@tbuchok) -- [#1238](/~https://github.com/cypress-io/request/pull/1238) Add examples README.md (@simov) - -### v2.48.0 (2014/11/12) -- [#1263](/~https://github.com/cypress-io/request/pull/1263) Fixed a syntax error / typo in README.md (@xna2) -- [#1253](/~https://github.com/cypress-io/request/pull/1253) Add multipart chunked flag (@simov, @nylen) -- [#1251](/~https://github.com/cypress-io/request/pull/1251) Clarify that defaults() does not modify global defaults (@nylen) -- [#1250](/~https://github.com/cypress-io/request/pull/1250) Improve documentation for pool and maxSockets options (@nylen) -- [#1237](/~https://github.com/cypress-io/request/pull/1237) Documenting error handling when using streams (@vmattos) -- [#1244](/~https://github.com/cypress-io/request/pull/1244) Finalize changelog command (@nylen) -- [#1241](/~https://github.com/cypress-io/request/pull/1241) Fix typo (@alexanderGugel) -- [#1223](/~https://github.com/cypress-io/request/pull/1223) Show latest version number instead of "upcoming" in changelog (@nylen) -- [#1236](/~https://github.com/cypress-io/request/pull/1236) Document how to use custom CA in README (#1229) (@hypesystem) -- [#1228](/~https://github.com/cypress-io/request/pull/1228) Support for oauth with RSA-SHA1 signing (@nylen) -- [#1216](/~https://github.com/cypress-io/request/pull/1216) Made json and multipart options coexist (@nylen, @simov) -- [#1225](/~https://github.com/cypress-io/request/pull/1225) Allow header white/exclusive lists in any case. (@RReverser) - -### v2.47.0 (2014/10/26) -- [#1222](/~https://github.com/cypress-io/request/pull/1222) Move from mikeal/request to cypress-io/request (@nylen) -- [#1220](/~https://github.com/cypress-io/request/pull/1220) update qs dependency to 2.3.1 (@FredKSchott) -- [#1212](/~https://github.com/cypress-io/request/pull/1212) Improve tests/test-timeout.js (@nylen) -- [#1219](/~https://github.com/cypress-io/request/pull/1219) remove old globalAgent workaround for node 0.4 (@request) -- [#1214](/~https://github.com/cypress-io/request/pull/1214) Remove cruft left over from optional dependencies (@nylen) -- [#1215](/~https://github.com/cypress-io/request/pull/1215) Add proxyHeaderExclusiveList option for proxy-only headers. (@RReverser) -- [#1211](/~https://github.com/cypress-io/request/pull/1211) Allow 'Host' header instead of 'host' and remember case across redirects (@nylen) -- [#1208](/~https://github.com/cypress-io/request/pull/1208) Improve release script (@nylen) -- [#1213](/~https://github.com/cypress-io/request/pull/1213) Support for custom cookie store (@nylen, @mitsuru) -- [#1197](/~https://github.com/cypress-io/request/pull/1197) Clean up some code around setting the agent (@FredKSchott) -- [#1209](/~https://github.com/cypress-io/request/pull/1209) Improve multipart form append test (@simov) -- [#1207](/~https://github.com/cypress-io/request/pull/1207) Update changelog (@nylen) -- [#1185](/~https://github.com/cypress-io/request/pull/1185) Stream multipart/related bodies (@simov) - -### v2.46.0 (2014/10/23) -- [#1198](/~https://github.com/cypress-io/request/pull/1198) doc for TLS/SSL protocol options (@shawnzhu) -- [#1200](/~https://github.com/cypress-io/request/pull/1200) Add a Gitter chat badge to README.md (@gitter-badger) -- [#1196](/~https://github.com/cypress-io/request/pull/1196) Upgrade taper test reporter to v0.3.0 (@nylen) -- [#1199](/~https://github.com/cypress-io/request/pull/1199) Fix lint error: undeclared var i (@nylen) -- [#1191](/~https://github.com/cypress-io/request/pull/1191) Move self.proxy decision logic out of init and into a helper (@FredKSchott) -- [#1190](/~https://github.com/cypress-io/request/pull/1190) Move _buildRequest() logic back into init (@FredKSchott) -- [#1186](/~https://github.com/cypress-io/request/pull/1186) Support Smarter Unix URL Scheme (@FredKSchott) -- [#1178](/~https://github.com/cypress-io/request/pull/1178) update form documentation for new usage (@FredKSchott) -- [#1180](/~https://github.com/cypress-io/request/pull/1180) Enable no-mixed-requires linting rule (@nylen) -- [#1184](/~https://github.com/cypress-io/request/pull/1184) Don't forward authorization header across redirects to different hosts (@nylen) -- [#1183](/~https://github.com/cypress-io/request/pull/1183) Correct README about pre and postamble CRLF using multipart and not mult... (@netpoetica) -- [#1179](/~https://github.com/cypress-io/request/pull/1179) Lint tests directory (@nylen) -- [#1169](/~https://github.com/cypress-io/request/pull/1169) add metadata for form-data file field (@dotcypress) -- [#1173](/~https://github.com/cypress-io/request/pull/1173) remove optional dependencies (@seanstrom) -- [#1165](/~https://github.com/cypress-io/request/pull/1165) Cleanup event listeners and remove function creation from init (@FredKSchott) -- [#1174](/~https://github.com/cypress-io/request/pull/1174) update the request.cookie docs to have a valid cookie example (@seanstrom) -- [#1168](/~https://github.com/cypress-io/request/pull/1168) create a detach helper and use detach helper in replace of nextTick (@seanstrom) -- [#1171](/~https://github.com/cypress-io/request/pull/1171) in post can send form data and use callback (@MiroRadenovic) -- [#1159](/~https://github.com/cypress-io/request/pull/1159) accept charset for x-www-form-urlencoded content-type (@seanstrom) -- [#1157](/~https://github.com/cypress-io/request/pull/1157) Update README.md: body with json=true (@Rob--W) -- [#1164](/~https://github.com/cypress-io/request/pull/1164) Disable tests/test-timeout.js on Travis (@nylen) -- [#1153](/~https://github.com/cypress-io/request/pull/1153) Document how to run a single test (@nylen) -- [#1144](/~https://github.com/cypress-io/request/pull/1144) adds documentation for the "response" event within the streaming section (@tbuchok) -- [#1162](/~https://github.com/cypress-io/request/pull/1162) Update eslintrc file to no longer allow past errors (@FredKSchott) -- [#1155](/~https://github.com/cypress-io/request/pull/1155) Support/use self everywhere (@seanstrom) -- [#1161](/~https://github.com/cypress-io/request/pull/1161) fix no-use-before-define lint warnings (@emkay) -- [#1156](/~https://github.com/cypress-io/request/pull/1156) adding curly brackets to get rid of lint errors (@emkay) -- [#1151](/~https://github.com/cypress-io/request/pull/1151) Fix localAddress test on OS X (@nylen) -- [#1145](/~https://github.com/cypress-io/request/pull/1145) documentation: fix outdated reference to setCookieSync old name in README (@FredKSchott) -- [#1131](/~https://github.com/cypress-io/request/pull/1131) Update pool documentation (@FredKSchott) -- [#1143](/~https://github.com/cypress-io/request/pull/1143) Rewrite all tests to use tape (@nylen) -- [#1137](/~https://github.com/cypress-io/request/pull/1137) Add ability to specifiy querystring lib in options. (@jgrund) -- [#1138](/~https://github.com/cypress-io/request/pull/1138) allow hostname and port in place of host on uri (@cappslock) -- [#1134](/~https://github.com/cypress-io/request/pull/1134) Fix multiple redirects and `self.followRedirect` (@blakeembrey) -- [#1130](/~https://github.com/cypress-io/request/pull/1130) documentation fix: add note about npm test for contributing (@FredKSchott) -- [#1120](/~https://github.com/cypress-io/request/pull/1120) Support/refactor request setup tunnel (@seanstrom) -- [#1129](/~https://github.com/cypress-io/request/pull/1129) linting fix: convert double quote strings to use single quotes (@FredKSchott) -- [#1124](/~https://github.com/cypress-io/request/pull/1124) linting fix: remove unneccesary semi-colons (@FredKSchott) - -### v2.45.0 (2014/10/06) -- [#1128](/~https://github.com/cypress-io/request/pull/1128) Add test for setCookie regression (@nylen) -- [#1127](/~https://github.com/cypress-io/request/pull/1127) added tests around using objects as values in a query string (@bcoe) -- [#1103](/~https://github.com/cypress-io/request/pull/1103) Support/refactor request constructor (@nylen, @seanstrom) -- [#1119](/~https://github.com/cypress-io/request/pull/1119) add basic linting to request library (@FredKSchott) -- [#1121](/~https://github.com/cypress-io/request/pull/1121) Revert "Explicitly use sync versions of cookie functions" (@nylen) -- [#1118](/~https://github.com/cypress-io/request/pull/1118) linting fix: Restructure bad empty if statement (@FredKSchott) -- [#1117](/~https://github.com/cypress-io/request/pull/1117) Fix a bad check for valid URIs (@FredKSchott) -- [#1113](/~https://github.com/cypress-io/request/pull/1113) linting fix: space out operators (@FredKSchott) -- [#1116](/~https://github.com/cypress-io/request/pull/1116) Fix typo in `noProxyHost` definition (@FredKSchott) -- [#1114](/~https://github.com/cypress-io/request/pull/1114) linting fix: Added a `new` operator that was missing when creating and throwing a new error (@FredKSchott) -- [#1096](/~https://github.com/cypress-io/request/pull/1096) No_proxy support (@samcday) -- [#1107](/~https://github.com/cypress-io/request/pull/1107) linting-fix: remove unused variables (@FredKSchott) -- [#1112](/~https://github.com/cypress-io/request/pull/1112) linting fix: Make return values consistent and more straitforward (@FredKSchott) -- [#1111](/~https://github.com/cypress-io/request/pull/1111) linting fix: authPieces was getting redeclared (@FredKSchott) -- [#1105](/~https://github.com/cypress-io/request/pull/1105) Use strict mode in request (@FredKSchott) -- [#1110](/~https://github.com/cypress-io/request/pull/1110) linting fix: replace lazy '==' with more strict '===' (@FredKSchott) -- [#1109](/~https://github.com/cypress-io/request/pull/1109) linting fix: remove function call from if-else conditional statement (@FredKSchott) -- [#1102](/~https://github.com/cypress-io/request/pull/1102) Fix to allow setting a `requester` on recursive calls to `request.defaults` (@tikotzky) -- [#1095](/~https://github.com/cypress-io/request/pull/1095) Tweaking engines in package.json (@pdehaan) -- [#1082](/~https://github.com/cypress-io/request/pull/1082) Forward the socket event from the httpModule request (@seanstrom) -- [#972](/~https://github.com/cypress-io/request/pull/972) Clarify gzip handling in the README (@kevinoid) -- [#1089](/~https://github.com/cypress-io/request/pull/1089) Mention that encoding defaults to utf8, not Buffer (@stuartpb) -- [#1088](/~https://github.com/cypress-io/request/pull/1088) Fix cookie example in README.md and make it more clear (@pipi32167) -- [#1027](/~https://github.com/cypress-io/request/pull/1027) Add support for multipart form data in request options. (@crocket) -- [#1076](/~https://github.com/cypress-io/request/pull/1076) use Request.abort() to abort the request when the request has timed-out (@seanstrom) -- [#1068](/~https://github.com/cypress-io/request/pull/1068) add optional postamble required by .NET multipart requests (@netpoetica) - -### v2.43.0 (2014/09/18) -- [#1057](/~https://github.com/cypress-io/request/pull/1057) Defaults should not overwrite defined options (@davidwood) -- [#1046](/~https://github.com/cypress-io/request/pull/1046) Propagate datastream errors, useful in case gzip fails. (@ZJONSSON, @Janpot) -- [#1063](/~https://github.com/cypress-io/request/pull/1063) copy the input headers object #1060 (@finnp) -- [#1031](/~https://github.com/cypress-io/request/pull/1031) Explicitly use sync versions of cookie functions (@ZJONSSON) -- [#1056](/~https://github.com/cypress-io/request/pull/1056) Fix redirects when passing url.parse(x) as URL to convenience method (@nylen) - -### v2.42.0 (2014/09/04) -- [#1053](/~https://github.com/cypress-io/request/pull/1053) Fix #1051 Parse auth properly when using non-tunneling proxy (@isaacs) - -### v2.41.0 (2014/09/04) -- [#1050](/~https://github.com/cypress-io/request/pull/1050) Pass whitelisted headers to tunneling proxy. Organize all tunneling logic. (@isaacs, @Feldhacker) -- [#1035](/~https://github.com/cypress-io/request/pull/1035) souped up nodei.co badge (@rvagg) -- [#1048](/~https://github.com/cypress-io/request/pull/1048) Aws is now possible over a proxy (@steven-aerts) -- [#1039](/~https://github.com/cypress-io/request/pull/1039) extract out helper functions to a helper file (@seanstrom) -- [#1021](/~https://github.com/cypress-io/request/pull/1021) Support/refactor indexjs (@seanstrom) -- [#1033](/~https://github.com/cypress-io/request/pull/1033) Improve and document debug options (@nylen) -- [#1034](/~https://github.com/cypress-io/request/pull/1034) Fix readme headings (@nylen) -- [#1030](/~https://github.com/cypress-io/request/pull/1030) Allow recursive request.defaults (@tikotzky) -- [#1029](/~https://github.com/cypress-io/request/pull/1029) Fix a couple of typos (@nylen) -- [#675](/~https://github.com/cypress-io/request/pull/675) Checking for SSL fault on connection before reading SSL properties (@VRMink) -- [#989](/~https://github.com/cypress-io/request/pull/989) Added allowRedirect function. Should return true if redirect is allowed or false otherwise (@doronin) -- [#1025](/~https://github.com/cypress-io/request/pull/1025) [fixes #1023] Set self._ended to true once response has ended (@mridgway) -- [#1020](/~https://github.com/cypress-io/request/pull/1020) Add back removed debug metadata (@FredKSchott) -- [#1008](/~https://github.com/cypress-io/request/pull/1008) Moving to module instead of cutomer buffer concatenation. (@mikeal) -- [#770](/~https://github.com/cypress-io/request/pull/770) Added dependency badge for README file; (@timgluz, @mafintosh, @lalitkapoor, @stash, @bobyrizov) -- [#1016](/~https://github.com/cypress-io/request/pull/1016) toJSON no longer results in an infinite loop, returns simple objects (@FredKSchott) -- [#1018](/~https://github.com/cypress-io/request/pull/1018) Remove pre-0.4.4 HTTPS fix (@mmalecki) -- [#1006](/~https://github.com/cypress-io/request/pull/1006) Migrate to caseless, fixes #1001 (@mikeal) -- [#995](/~https://github.com/cypress-io/request/pull/995) Fix parsing array of objects (@sjonnet19) -- [#999](/~https://github.com/cypress-io/request/pull/999) Fix fallback for browserify for optional modules. (@eiriksm) -- [#996](/~https://github.com/cypress-io/request/pull/996) Wrong oauth signature when multiple same param keys exist [updated] (@bengl) - -### v2.40.0 (2014/08/06) -- [#992](/~https://github.com/cypress-io/request/pull/992) Fix security vulnerability. Update qs (@poeticninja) -- [#988](/~https://github.com/cypress-io/request/pull/988) β€œ--” -> β€œβ€”β€ (@upisfree) -- [#987](/~https://github.com/cypress-io/request/pull/987) Show optional modules as being loaded by the module that reqeusted them (@iarna) - -### v2.39.0 (2014/07/24) -- [#976](/~https://github.com/cypress-io/request/pull/976) Update README.md (@pvoznenko) - -### v2.38.0 (2014/07/22) -- [#952](/~https://github.com/cypress-io/request/pull/952) Adding support to client certificate with proxy use case (@ofirshaked) -- [#884](/~https://github.com/cypress-io/request/pull/884) Documented tough-cookie installation. (@wbyoung) -- [#935](/~https://github.com/cypress-io/request/pull/935) Correct repository url (@fritx) -- [#963](/~https://github.com/cypress-io/request/pull/963) Update changelog (@nylen) -- [#960](/~https://github.com/cypress-io/request/pull/960) Support gzip with encoding on node pre-v0.9.4 (@kevinoid) -- [#953](/~https://github.com/cypress-io/request/pull/953) Add async Content-Length computation when using form-data (@LoicMahieu) -- [#844](/~https://github.com/cypress-io/request/pull/844) Add support for HTTP[S]_PROXY environment variables. Fixes #595. (@jvmccarthy) -- [#946](/~https://github.com/cypress-io/request/pull/946) defaults: merge headers (@aj0strow) - -### v2.37.0 (2014/07/07) -- [#957](/~https://github.com/cypress-io/request/pull/957) Silence EventEmitter memory leak warning #311 (@watson) -- [#955](/~https://github.com/cypress-io/request/pull/955) check for content-length header before setting it in nextTick (@camilleanne) -- [#951](/~https://github.com/cypress-io/request/pull/951) Add support for gzip content decoding (@kevinoid) -- [#949](/~https://github.com/cypress-io/request/pull/949) Manually enter querystring in form option (@charlespwd) -- [#944](/~https://github.com/cypress-io/request/pull/944) Make request work with browserify (@eiriksm) -- [#943](/~https://github.com/cypress-io/request/pull/943) New mime module (@eiriksm) -- [#927](/~https://github.com/cypress-io/request/pull/927) Bump version of hawk dep. (@samccone) -- [#907](/~https://github.com/cypress-io/request/pull/907) append secureOptions to poolKey (@medovob) - -### v2.35.0 (2014/05/17) -- [#901](/~https://github.com/cypress-io/request/pull/901) Fixes #555 (@pigulla) -- [#897](/~https://github.com/cypress-io/request/pull/897) merge with default options (@vohof) -- [#891](/~https://github.com/cypress-io/request/pull/891) fixes 857 - options object is mutated by calling request (@lalitkapoor) -- [#869](/~https://github.com/cypress-io/request/pull/869) Pipefilter test (@tgohn) -- [#866](/~https://github.com/cypress-io/request/pull/866) Fix typo (@dandv) -- [#861](/~https://github.com/cypress-io/request/pull/861) Add support for RFC 6750 Bearer Tokens (@phedny) -- [#809](/~https://github.com/cypress-io/request/pull/809) upgrade tunnel-proxy to 0.4.0 (@ksato9700) -- [#850](/~https://github.com/cypress-io/request/pull/850) Fix word consistency in readme (@0xNobody) -- [#810](/~https://github.com/cypress-io/request/pull/810) add some exposition to mpu example in README.md (@mikermcneil) -- [#840](/~https://github.com/cypress-io/request/pull/840) improve error reporting for invalid protocols (@FND) -- [#821](/~https://github.com/cypress-io/request/pull/821) added secureOptions back (@nw) -- [#815](/~https://github.com/cypress-io/request/pull/815) Create changelog based on pull requests (@lalitkapoor) - -### v2.34.0 (2014/02/18) -- [#516](/~https://github.com/cypress-io/request/pull/516) UNIX Socket URL Support (@lyuzashi) -- [#801](/~https://github.com/cypress-io/request/pull/801) 794 ignore cookie parsing and domain errors (@lalitkapoor) -- [#802](/~https://github.com/cypress-io/request/pull/802) Added the Apache license to the package.json. (@keskival) -- [#793](/~https://github.com/cypress-io/request/pull/793) Adds content-length calculation when submitting forms using form-data li... (@Juul) -- [#785](/~https://github.com/cypress-io/request/pull/785) Provide ability to override content-type when `json` option used (@vvo) -- [#781](/~https://github.com/cypress-io/request/pull/781) simpler isReadStream function (@joaojeronimo) - -### v2.32.0 (2014/01/16) -- [#767](/~https://github.com/cypress-io/request/pull/767) Use tough-cookie CookieJar sync API (@stash) -- [#764](/~https://github.com/cypress-io/request/pull/764) Case-insensitive authentication scheme (@bobyrizov) -- [#763](/~https://github.com/cypress-io/request/pull/763) Upgrade tough-cookie to 0.10.0 (@stash) -- [#744](/~https://github.com/cypress-io/request/pull/744) Use Cookie.parse (@lalitkapoor) -- [#757](/~https://github.com/cypress-io/request/pull/757) require aws-sign2 (@mafintosh) - -### v2.31.0 (2014/01/08) -- [#645](/~https://github.com/cypress-io/request/pull/645) update twitter api url to v1.1 (@mick) -- [#746](/~https://github.com/cypress-io/request/pull/746) README: Markdown code highlight (@weakish) -- [#745](/~https://github.com/cypress-io/request/pull/745) updating setCookie example to make it clear that the callback is required (@emkay) -- [#742](/~https://github.com/cypress-io/request/pull/742) Add note about JSON output body type (@iansltx) -- [#741](/~https://github.com/cypress-io/request/pull/741) README example is using old cookie jar api (@emkay) -- [#736](/~https://github.com/cypress-io/request/pull/736) Fix callback arguments documentation (@mmalecki) -- [#732](/~https://github.com/cypress-io/request/pull/732) JSHINT: Creating global 'for' variable. Should be 'for (var ...'. (@Fritz-Lium) -- [#730](/~https://github.com/cypress-io/request/pull/730) better HTTP DIGEST support (@dai-shi) -- [#728](/~https://github.com/cypress-io/request/pull/728) Fix TypeError when calling request.cookie (@scarletmeow) -- [#727](/~https://github.com/cypress-io/request/pull/727) fix requester bug (@jchris) -- [#724](/~https://github.com/cypress-io/request/pull/724) README.md: add custom HTTP Headers example. (@tcort) -- [#719](/~https://github.com/cypress-io/request/pull/719) Made a comment gender neutral. (@unsetbit) -- [#715](/~https://github.com/cypress-io/request/pull/715) Request.multipart no longer crashes when header 'Content-type' present (@pastaclub) -- [#710](/~https://github.com/cypress-io/request/pull/710) Fixing listing in callback part of docs. (@lukasz-zak) -- [#696](/~https://github.com/cypress-io/request/pull/696) Edited README.md for formatting and clarity of phrasing (@Zearin) -- [#694](/~https://github.com/cypress-io/request/pull/694) Typo in README (@VRMink) -- [#690](/~https://github.com/cypress-io/request/pull/690) Handle blank password in basic auth. (@diversario) -- [#682](/~https://github.com/cypress-io/request/pull/682) Optional dependencies (@Turbo87) -- [#683](/~https://github.com/cypress-io/request/pull/683) Travis CI support (@Turbo87) -- [#674](/~https://github.com/cypress-io/request/pull/674) change cookie module,to tough-cookie.please check it . (@sxyizhiren) -- [#666](/~https://github.com/cypress-io/request/pull/666) make `ciphers` and `secureProtocol` to work in https request (@richarddong) -- [#656](/~https://github.com/cypress-io/request/pull/656) Test case for #304. (@diversario) -- [#662](/~https://github.com/cypress-io/request/pull/662) option.tunnel to explicitly disable tunneling (@seanmonstar) -- [#659](/~https://github.com/cypress-io/request/pull/659) fix failure when running with NODE_DEBUG=request, and a test for that (@jrgm) -- [#630](/~https://github.com/cypress-io/request/pull/630) Send random cnonce for HTTP Digest requests (@wprl) -- [#619](/~https://github.com/cypress-io/request/pull/619) decouple things a bit (@joaojeronimo) -- [#613](/~https://github.com/cypress-io/request/pull/613) Fixes #583, moved initialization of self.uri.pathname (@lexander) -- [#605](/~https://github.com/cypress-io/request/pull/605) Only include ":" + pass in Basic Auth if it's defined (fixes #602) (@bendrucker) -- [#596](/~https://github.com/cypress-io/request/pull/596) Global agent is being used when pool is specified (@Cauldrath) -- [#594](/~https://github.com/cypress-io/request/pull/594) Emit complete event when there is no callback (@RomainLK) -- [#601](/~https://github.com/cypress-io/request/pull/601) Fixed a small typo (@michalstanko) -- [#589](/~https://github.com/cypress-io/request/pull/589) Prevent setting headers after they are sent (@geek) -- [#587](/~https://github.com/cypress-io/request/pull/587) Global cookie jar disabled by default (@threepointone) -- [#544](/~https://github.com/cypress-io/request/pull/544) Update http-signature version. (@davidlehn) -- [#581](/~https://github.com/cypress-io/request/pull/581) Fix spelling of "ignoring." (@bigeasy) -- [#568](/~https://github.com/cypress-io/request/pull/568) use agentOptions to create agent when specified in request (@SamPlacette) -- [#564](/~https://github.com/cypress-io/request/pull/564) Fix redirections (@criloz) -- [#541](/~https://github.com/cypress-io/request/pull/541) The exported request function doesn't have an auth method (@tschaub) -- [#542](/~https://github.com/cypress-io/request/pull/542) Expose Request class (@regality) -- [#536](/~https://github.com/cypress-io/request/pull/536) Allow explicitly empty user field for basic authentication. (@mikeando) -- [#532](/~https://github.com/cypress-io/request/pull/532) fix typo (@fredericosilva) -- [#497](/~https://github.com/cypress-io/request/pull/497) Added redirect event (@Cauldrath) -- [#503](/~https://github.com/cypress-io/request/pull/503) Fix basic auth for passwords that contain colons (@tonistiigi) -- [#521](/~https://github.com/cypress-io/request/pull/521) Improving test-localAddress.js (@noway) -- [#529](/~https://github.com/cypress-io/request/pull/529) dependencies versions bump (@jodaka) -- [#523](/~https://github.com/cypress-io/request/pull/523) Updating dependencies (@noway) -- [#520](/~https://github.com/cypress-io/request/pull/520) Fixing test-tunnel.js (@noway) -- [#519](/~https://github.com/cypress-io/request/pull/519) Update internal path state on post-creation QS changes (@jblebrun) -- [#510](/~https://github.com/cypress-io/request/pull/510) Add HTTP Signature support. (@davidlehn) -- [#502](/~https://github.com/cypress-io/request/pull/502) Fix POST (and probably other) requests that are retried after 401 Unauthorized (@nylen) -- [#508](/~https://github.com/cypress-io/request/pull/508) Honor the .strictSSL option when using proxies (tunnel-agent) (@jhs) -- [#512](/~https://github.com/cypress-io/request/pull/512) Make password optional to support the format: http://username@hostname/ (@pajato1) -- [#513](/~https://github.com/cypress-io/request/pull/513) add 'localAddress' support (@yyfrankyy) -- [#498](/~https://github.com/cypress-io/request/pull/498) Moving response emit above setHeaders on destination streams (@kenperkins) -- [#490](/~https://github.com/cypress-io/request/pull/490) Empty response body (3-rd argument) must be passed to callback as an empty string (@Olegas) -- [#479](/~https://github.com/cypress-io/request/pull/479) Changing so if Accept header is explicitly set, sending json does not ov... (@RoryH) -- [#475](/~https://github.com/cypress-io/request/pull/475) Use `unescape` from `querystring` (@shimaore) -- [#473](/~https://github.com/cypress-io/request/pull/473) V0.10 compat (@isaacs) -- [#471](/~https://github.com/cypress-io/request/pull/471) Using querystring library from visionmedia (@kbackowski) -- [#461](/~https://github.com/cypress-io/request/pull/461) Strip the UTF8 BOM from a UTF encoded response (@kppullin) -- [#460](/~https://github.com/cypress-io/request/pull/460) hawk 0.10.0 (@hueniverse) -- [#462](/~https://github.com/cypress-io/request/pull/462) if query params are empty, then request path shouldn't end with a '?' (merges cleanly now) (@jaipandya) -- [#456](/~https://github.com/cypress-io/request/pull/456) hawk 0.9.0 (@hueniverse) -- [#429](/~https://github.com/cypress-io/request/pull/429) Copy options before adding callback. (@nrn, @nfriedly, @youurayy, @jplock, @kapetan, @landeiro, @othiym23, @mmalecki) -- [#454](/~https://github.com/cypress-io/request/pull/454) Destroy the response if present when destroying the request (clean merge) (@mafintosh) -- [#310](/~https://github.com/cypress-io/request/pull/310) Twitter Oauth Stuff Out of Date; Now Updated (@joemccann, @isaacs, @mscdex) -- [#413](/~https://github.com/cypress-io/request/pull/413) rename googledoodle.png to .jpg (@nfriedly, @youurayy, @jplock, @kapetan, @landeiro, @othiym23, @mmalecki) -- [#448](/~https://github.com/cypress-io/request/pull/448) Convenience method for PATCH (@mloar) -- [#444](/~https://github.com/cypress-io/request/pull/444) protect against double callbacks on error path (@spollack) -- [#433](/~https://github.com/cypress-io/request/pull/433) Added support for HTTPS cert & key (@mmalecki) -- [#430](/~https://github.com/cypress-io/request/pull/430) Respect specified {Host,host} headers, not just {host} (@andrewschaaf) -- [#415](/~https://github.com/cypress-io/request/pull/415) Fixed a typo. (@jerem) -- [#338](/~https://github.com/cypress-io/request/pull/338) Add more auth options, including digest support (@nylen) -- [#403](/~https://github.com/cypress-io/request/pull/403) Optimize environment lookup to happen once only (@mmalecki) -- [#398](/~https://github.com/cypress-io/request/pull/398) Add more reporting to tests (@mmalecki) -- [#388](/~https://github.com/cypress-io/request/pull/388) Ensure "safe" toJSON doesn't break EventEmitters (@othiym23) -- [#381](/~https://github.com/cypress-io/request/pull/381) Resolving "Invalid signature. Expected signature base string: " (@landeiro) -- [#380](/~https://github.com/cypress-io/request/pull/380) Fixes missing host header on retried request when using forever agent (@mac-) -- [#376](/~https://github.com/cypress-io/request/pull/376) Headers lost on redirect (@kapetan) -- [#375](/~https://github.com/cypress-io/request/pull/375) Fix for missing oauth_timestamp parameter (@jplock) -- [#374](/~https://github.com/cypress-io/request/pull/374) Correct Host header for proxy tunnel CONNECT (@youurayy) -- [#370](/~https://github.com/cypress-io/request/pull/370) Twitter reverse auth uses x_auth_mode not x_auth_type (@drudge) -- [#369](/~https://github.com/cypress-io/request/pull/369) Don't remove x_auth_mode for Twitter reverse auth (@drudge) -- [#344](/~https://github.com/cypress-io/request/pull/344) Make AWS auth signing find headers correctly (@nlf) -- [#363](/~https://github.com/cypress-io/request/pull/363) rfc3986 on base_uri, now passes tests (@jeffmarshall) -- [#362](/~https://github.com/cypress-io/request/pull/362) Running `rfc3986` on `base_uri` in `oauth.hmacsign` instead of just `encodeURIComponent` (@jeffmarshall) -- [#361](/~https://github.com/cypress-io/request/pull/361) Don't create a Content-Length header if we already have it set (@danjenkins) -- [#360](/~https://github.com/cypress-io/request/pull/360) Delete self._form along with everything else on redirect (@jgautier) -- [#355](/~https://github.com/cypress-io/request/pull/355) stop sending erroneous headers on redirected requests (@azylman) -- [#332](/~https://github.com/cypress-io/request/pull/332) Fix #296 - Only set Content-Type if body exists (@Marsup) -- [#343](/~https://github.com/cypress-io/request/pull/343) Allow AWS to work in more situations, added a note in the README on its usage (@nlf) -- [#320](/~https://github.com/cypress-io/request/pull/320) request.defaults() doesn't need to wrap jar() (@StuartHarris) -- [#322](/~https://github.com/cypress-io/request/pull/322) Fix + test for piped into request bumped into redirect. #321 (@alexindigo) -- [#326](/~https://github.com/cypress-io/request/pull/326) Do not try to remove listener from an undefined connection (@CartoDB) -- [#318](/~https://github.com/cypress-io/request/pull/318) Pass servername to tunneling secure socket creation (@isaacs) -- [#317](/~https://github.com/cypress-io/request/pull/317) Workaround for #313 (@isaacs) -- [#293](/~https://github.com/cypress-io/request/pull/293) Allow parser errors to bubble up to request (@mscdex) -- [#290](/~https://github.com/cypress-io/request/pull/290) A test for #289 (@isaacs) -- [#280](/~https://github.com/cypress-io/request/pull/280) Like in node.js print options if NODE_DEBUG contains the word request (@Filirom1) -- [#207](/~https://github.com/cypress-io/request/pull/207) Fix #206 Change HTTP/HTTPS agent when redirecting between protocols (@isaacs) -- [#214](/~https://github.com/cypress-io/request/pull/214) documenting additional behavior of json option (@jphaas, @vpulim) -- [#272](/~https://github.com/cypress-io/request/pull/272) Boundary begins with CRLF? (@elspoono, @timshadel, @naholyr, @nanodocumet, @TehShrike) -- [#284](/~https://github.com/cypress-io/request/pull/284) Remove stray `console.log()` call in multipart generator. (@bcherry) -- [#241](/~https://github.com/cypress-io/request/pull/241) Composability updates suggested by issue #239 (@polotek) -- [#282](/~https://github.com/cypress-io/request/pull/282) OAuth Authorization header contains non-"oauth_" parameters (@jplock) -- [#279](/~https://github.com/cypress-io/request/pull/279) fix tests with boundary by injecting boundry from header (@benatkin) -- [#273](/~https://github.com/cypress-io/request/pull/273) Pipe back pressure issue (@mafintosh) -- [#268](/~https://github.com/cypress-io/request/pull/268) I'm not OCD seriously (@TehShrike) -- [#263](/~https://github.com/cypress-io/request/pull/263) Bug in OAuth key generation for sha1 (@nanodocumet) -- [#265](/~https://github.com/cypress-io/request/pull/265) uncaughtException when redirected to invalid URI (@naholyr) -- [#262](/~https://github.com/cypress-io/request/pull/262) JSON test should check for equality (@timshadel) -- [#261](/~https://github.com/cypress-io/request/pull/261) Setting 'pool' to 'false' does NOT disable Agent pooling (@timshadel) -- [#249](/~https://github.com/cypress-io/request/pull/249) Fix for the fix of your (closed) issue #89 where self.headers[content-length] is set to 0 for all methods (@sethbridges, @polotek, @zephrax, @jeromegn) -- [#255](/~https://github.com/cypress-io/request/pull/255) multipart allow body === '' ( the empty string ) (@Filirom1) -- [#260](/~https://github.com/cypress-io/request/pull/260) fixed just another leak of 'i' (@sreuter) -- [#246](/~https://github.com/cypress-io/request/pull/246) Fixing the set-cookie header (@jeromegn) -- [#243](/~https://github.com/cypress-io/request/pull/243) Dynamic boundary (@zephrax) -- [#240](/~https://github.com/cypress-io/request/pull/240) don't error when null is passed for options (@polotek) -- [#211](/~https://github.com/cypress-io/request/pull/211) Replace all occurrences of special chars in RFC3986 (@chriso, @vpulim) -- [#224](/~https://github.com/cypress-io/request/pull/224) Multipart content-type change (@janjongboom) -- [#217](/~https://github.com/cypress-io/request/pull/217) need to use Authorization (titlecase) header with Tumblr OAuth (@visnup) -- [#203](/~https://github.com/cypress-io/request/pull/203) Fix cookie and redirect bugs and add auth support for HTTPS tunnel (@vpulim) -- [#199](/~https://github.com/cypress-io/request/pull/199) Tunnel (@isaacs) -- [#198](/~https://github.com/cypress-io/request/pull/198) Bugfix on forever usage of util.inherits (@isaacs) -- [#197](/~https://github.com/cypress-io/request/pull/197) Make ForeverAgent work with HTTPS (@isaacs) -- [#193](/~https://github.com/cypress-io/request/pull/193) Fixes GH-119 (@goatslacker) -- [#188](/~https://github.com/cypress-io/request/pull/188) Add abort support to the returned request (@itay) -- [#176](/~https://github.com/cypress-io/request/pull/176) Querystring option (@csainty) -- [#182](/~https://github.com/cypress-io/request/pull/182) Fix request.defaults to support (uri, options, callback) api (@twilson63) -- [#180](/~https://github.com/cypress-io/request/pull/180) Modified the post, put, head and del shortcuts to support uri optional param (@twilson63) -- [#179](/~https://github.com/cypress-io/request/pull/179) fix to add opts in .pipe(stream, opts) (@substack) -- [#177](/~https://github.com/cypress-io/request/pull/177) Issue #173 Support uri as first and optional config as second argument (@twilson63) -- [#170](/~https://github.com/cypress-io/request/pull/170) can't create a cookie in a wrapped request (defaults) (@fabianonunes) -- [#168](/~https://github.com/cypress-io/request/pull/168) Picking off an EasyFix by adding some missing mimetypes. (@serby) -- [#161](/~https://github.com/cypress-io/request/pull/161) Fix cookie jar/headers.cookie collision (#125) (@papandreou) -- [#162](/~https://github.com/cypress-io/request/pull/162) Fix issue #159 (@dpetukhov) -- [#90](/~https://github.com/cypress-io/request/pull/90) add option followAllRedirects to follow post/put redirects (@jroes) -- [#148](/~https://github.com/cypress-io/request/pull/148) Retry Agent (@thejh) -- [#146](/~https://github.com/cypress-io/request/pull/146) Multipart should respect content-type if previously set (@apeace) -- [#144](/~https://github.com/cypress-io/request/pull/144) added "form" option to readme (@petejkim) -- [#133](/~https://github.com/cypress-io/request/pull/133) Fixed cookies parsing (@afanasy) -- [#135](/~https://github.com/cypress-io/request/pull/135) host vs hostname (@iangreenleaf) -- [#132](/~https://github.com/cypress-io/request/pull/132) return the body as a Buffer when encoding is set to null (@jahewson) -- [#112](/~https://github.com/cypress-io/request/pull/112) Support using a custom http-like module (@jhs) -- [#104](/~https://github.com/cypress-io/request/pull/104) Cookie handling contains bugs (@janjongboom) -- [#121](/~https://github.com/cypress-io/request/pull/121) Another patch for cookie handling regression (@jhurliman) -- [#117](/~https://github.com/cypress-io/request/pull/117) Remove the global `i` (@3rd-Eden) -- [#110](/~https://github.com/cypress-io/request/pull/110) Update to Iris Couch URL (@jhs) -- [#86](/~https://github.com/cypress-io/request/pull/86) Can't post binary to multipart requests (@kkaefer) -- [#105](/~https://github.com/cypress-io/request/pull/105) added test for proxy option. (@dominictarr) -- [#102](/~https://github.com/cypress-io/request/pull/102) Implemented cookies - closes issue 82: /~https://github.com/mikeal/request/issues/82 (@alessioalex) -- [#97](/~https://github.com/cypress-io/request/pull/97) Typo in previous pull causes TypeError in non-0.5.11 versions (@isaacs) -- [#96](/~https://github.com/cypress-io/request/pull/96) Authless parsed url host support (@isaacs) -- [#81](/~https://github.com/cypress-io/request/pull/81) Enhance redirect handling (@danmactough) -- [#78](/~https://github.com/cypress-io/request/pull/78) Don't try to do strictSSL for non-ssl connections (@isaacs) -- [#76](/~https://github.com/cypress-io/request/pull/76) Bug when a request fails and a timeout is set (@Marsup) -- [#70](/~https://github.com/cypress-io/request/pull/70) add test script to package.json (@isaacs, @aheckmann) -- [#73](/~https://github.com/cypress-io/request/pull/73) Fix #71 Respect the strictSSL flag (@isaacs) -- [#69](/~https://github.com/cypress-io/request/pull/69) Flatten chunked requests properly (@isaacs) -- [#67](/~https://github.com/cypress-io/request/pull/67) fixed global variable leaks (@aheckmann) -- [#66](/~https://github.com/cypress-io/request/pull/66) Do not overwrite established content-type headers for read stream deliver (@voodootikigod) -- [#53](/~https://github.com/cypress-io/request/pull/53) Parse json: Issue #51 (@benatkin) -- [#45](/~https://github.com/cypress-io/request/pull/45) Added timeout option (@mbrevoort) -- [#35](/~https://github.com/cypress-io/request/pull/35) The "end" event isn't emitted for some responses (@voxpelli) -- [#31](/~https://github.com/cypress-io/request/pull/31) Error on piping a request to a destination (@tobowers) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index ccff4a26f..000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,77 +0,0 @@ -# Contributing to Request - -:+1::tada: First off, thanks for taking the time to contribute! :tada::+1: - -The following is a set of guidelines for contributing to Request and its packages, which are hosted in the [Request Organization](/~https://github.com/request) on GitHub. -These are just guidelines, not rules, use your best judgment and feel free to propose changes to this document in a pull request. - -## Submitting an Issue - -1. Provide a small self **sufficient** code example to **reproduce** the issue. -2. Run your test code using [request-debug](/~https://github.com/cypress-io/request-debug) and copy/paste the results inside the issue. -3. You should **always** use fenced code blocks when submitting code examples or any other formatted output: -
-
-```js
-put your javascript code here
-```
-
-```
-put any other formatted output here,
-like for example the one returned from using request-debug
-```
-
-  
- -If the problem cannot be reliably reproduced, the issue will be marked as `Not enough info (see CONTRIBUTING.md)`. - -If the problem is not related to request the issue will be marked as `Help (please use Stackoverflow)`. - -## Submitting a Pull Request - -1. In almost all of the cases your PR **needs tests**. Make sure you have any. -2. Run `npm test` locally. Fix any errors before pushing to GitHub. -3. After submitting the PR a build will be triggered on TravisCI. Wait for it to ends and make sure all jobs are passing. - ---- - -## Becoming a Contributor - -Individuals making significant and valuable contributions are given -commit-access to the project to contribute as they see fit. This project is -more like an open wiki than a standard guarded open source project. - -## Rules - -There are a few basic ground-rules for contributors: - -1. **No `--force` pushes** or modifying the Git history in any way. -2. **Non-master branches** ought to be used for ongoing work. -3. **Any** change should be added through Pull Request. -4. **External API changes and significant modifications** ought to be subject - to an **internal pull-request** to solicit feedback from other contributors. -5. Internal pull-requests to solicit feedback are _encouraged_ for any other - non-trivial contribution but left to the discretion of the contributor. -6. For significant changes wait a full 24 hours before merging so that active - contributors who are distributed throughout the world have a chance to weigh - in. -7. Contributors should attempt to adhere to the prevailing code-style. -8. Run `npm test` locally before submitting your PR, to catch any easy to miss - style & testing issues. To diagnose test failures, there are two ways to - run a single test file: - - `npx tap tests/test-file.js` - run using the default - [`tap`](https://www.npmjs.com/package/tap) test runner. - - `node tests/test-file.js` - view the raw - [tap](https://testanything.org/) output. - -## Releases - -Declaring formal releases remains the prerogative of the project maintainer. - -This package uses semantic versioning and [semantic-release](/~https://github.com/semantic-release/semantic-release) to auto-publish releases to npm upon merge into the master branch. - -## Changes to this arrangement - -This is an experiment and feedback is welcome! This document may also be -subject to pull-requests or changes by contributors where you believe you have -something valuable to add or change. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index a4a9aee0c..000000000 --- a/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/README.md b/README.md index 47bc4da72..870f10d4f 100644 --- a/README.md +++ b/README.md @@ -3,1030 +3,4 @@ [![npm package](https://nodei.co/npm/@cypress/request.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/@cypress/request/) -**This is a fork of [`request`](/~https://github.com/request/request) for use in [Cypress](/~https://github.com/cypress-io/cypress).** - -## Super simple to use - -Request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default. - -```js -const request = require('@cypress/request'); -request('http://www.google.com', function (error, response, body) { - console.error('error:', error); // Print the error if one occurred - console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received - console.log('body:', body); // Print the HTML for the Google homepage. -}); -``` - - -## Table of contents - -- [Streaming](#streaming) -- [Promises & Async/Await](#promises--asyncawait) -- [Forms](#forms) -- [HTTP Authentication](#http-authentication) -- [Custom HTTP Headers](#custom-http-headers) -- [Proxies](#proxies) -- [Unix Domain Sockets](#unix-domain-sockets) -- [TLS/SSL Protocol](#tlsssl-protocol) -- [Support for HAR 1.2](#support-for-har-12) -- [**All Available Options**](#requestoptions-callback) - -Request also offers [convenience methods](#convenience-methods) like -`request.defaults` and `request.post`, and there are -lots of [usage examples](#examples) and several -[debugging techniques](#debugging). - - ---- - - -## Streaming - -You can stream any response to a file stream. - -```js -request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png')) -``` - -You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types (in this case `application/json`) and use the proper `content-type` in the PUT request (if the headers don’t already provide one). - -```js -fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json')) -``` - -Request can also `pipe` to itself. When doing so, `content-type` and `content-length` are preserved in the PUT headers. - -```js -request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png')) -``` - -Request emits a "response" event when a response is received. The `response` argument will be an instance of [http.IncomingMessage](https://nodejs.org/api/http.html#http_class_http_incomingmessage). - -```js -request - .get('http://google.com/img.png') - .on('response', function(response) { - console.log(response.statusCode) // 200 - console.log(response.headers['content-type']) // 'image/png' - }) - .pipe(request.put('http://mysite.com/img.png')) -``` - -To easily handle errors when streaming requests, listen to the `error` event before piping: - -```js -request - .get('http://mysite.com/doodle.png') - .on('error', function(err) { - console.error(err) - }) - .pipe(fs.createWriteStream('doodle.png')) -``` - -Now let’s get fancy. - -```js -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - if (req.method === 'PUT') { - req.pipe(request.put('http://mysite.com/doodle.png')) - } else if (req.method === 'GET' || req.method === 'HEAD') { - request.get('http://mysite.com/doodle.png').pipe(resp) - } - } -}) -``` - -You can also `pipe()` from `http.ServerRequest` instances, as well as to `http.ServerResponse` instances. The HTTP method, headers, and entity-body data will be sent. Which means that, if you don't really care about security, you can do: - -```js -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - const x = request('http://mysite.com/doodle.png') - req.pipe(x) - x.pipe(resp) - } -}) -``` - -And since `pipe()` returns the destination stream in β‰₯ Node 0.5.x you can do one line proxying. :) - -```js -req.pipe(request('http://mysite.com/doodle.png')).pipe(resp) -``` - -Also, none of this new functionality conflicts with requests previous features, it just expands them. - -```js -const r = request.defaults({'proxy':'http://localproxy.com'}) - -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - r.get('http://google.com/doodle.png').pipe(resp) - } -}) -``` - -You can still use intermediate proxies, the requests will still follow HTTP forwards, etc. - -[back to top](#table-of-contents) - - ---- - - -## Promises & Async/Await - -`request` supports both streaming and callback interfaces natively. If you'd like `request` to return a Promise instead, you can use an alternative interface wrapper for `request`. These wrappers can be useful if you prefer to work with Promises, or if you'd like to use `async`/`await` in ES2017. - -Several alternative interfaces are provided by the request team, including: -- [`request-promise`](/~https://github.com/cypress-io/request-promise) (uses [Bluebird](/~https://github.com/petkaantonov/bluebird) Promises) -- [`request-promise-native`](/~https://github.com/cypress-io/request-promise-native) (uses native Promises) -- [`request-promise-any`](/~https://github.com/cypress-io/request-promise-any) (uses [any-promise](https://www.npmjs.com/package/any-promise) Promises) - -Also, [`util.promisify`](https://nodejs.org/api/util.html#util_util_promisify_original), which is available from Node.js v8.0 can be used to convert a regular function that takes a callback to return a promise instead. - - -[back to top](#table-of-contents) - - ---- - - -## Forms - -`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API. - - -#### application/x-www-form-urlencoded (URL-Encoded Forms) - -URL-encoded forms are simple. - -```js -request.post('http://service.com/upload', {form:{key:'value'}}) -// or -request.post('http://service.com/upload').form({key:'value'}) -// or -request.post({url:'http://service.com/upload', form: {key:'value'}}, function(err,httpResponse,body){ /* ... */ }) -``` - - -#### multipart/form-data (Multipart Form Uploads) - -For `multipart/form-data` we use the [form-data](/~https://github.com/form-data/form-data) library by [@felixge](/~https://github.com/felixge). For the most cases, you can pass your upload form data via the `formData` option. - - -```js -const formData = { - // Pass a simple key-value pair - my_field: 'my_value', - // Pass data via Buffers - my_buffer: Buffer.from([1, 2, 3]), - // Pass data via Streams - my_file: fs.createReadStream(__dirname + '/unicycle.jpg'), - // Pass multiple values /w an Array - attachments: [ - fs.createReadStream(__dirname + '/attachment1.jpg'), - fs.createReadStream(__dirname + '/attachment2.jpg') - ], - // Pass optional meta-data with an 'options' object with style: {value: DATA, options: OPTIONS} - // Use case: for some types of streams, you'll need to provide "file"-related information manually. - // See the `form-data` README for more information about options: /~https://github.com/form-data/form-data - custom_file: { - value: fs.createReadStream('/dev/urandom'), - options: { - filename: 'topsecret.jpg', - contentType: 'image/jpeg' - } - } -}; -request.post({url:'http://service.com/upload', formData: formData}, function optionalCallback(err, httpResponse, body) { - if (err) { - return console.error('upload failed:', err); - } - console.log('Upload successful! Server responded with:', body); -}); -``` - -For advanced cases, you can access the form-data object itself via `r.form()`. This can be modified until the request is fired on the next cycle of the event-loop. (Note that this calling `form()` will clear the currently set form data for that request.) - -```js -// NOTE: Advanced use-case, for normal use see 'formData' usage above -const r = request.post('http://service.com/upload', function optionalCallback(err, httpResponse, body) {...}) -const form = r.form(); -form.append('my_field', 'my_value'); -form.append('my_buffer', Buffer.from([1, 2, 3])); -form.append('custom_file', fs.createReadStream(__dirname + '/unicycle.jpg'), {filename: 'unicycle.jpg'}); -``` -See the [form-data README](/~https://github.com/form-data/form-data) for more information & examples. - - -#### multipart/related - -Some variations in different HTTP implementations require a newline/CRLF before, after, or both before and after the boundary of a `multipart/related` request (using the multipart option). This has been observed in the .NET WebAPI version 4.0. You can turn on a boundary preambleCRLF or postamble by passing them as `true` to your request options. - -```js - request({ - method: 'PUT', - preambleCRLF: true, - postambleCRLF: true, - uri: 'http://service.com/upload', - multipart: [ - { - 'content-type': 'application/json', - body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - }, - { body: 'I am an attachment' }, - { body: fs.createReadStream('image.png') } - ], - // alternatively pass an object containing additional options - multipart: { - chunked: false, - data: [ - { - 'content-type': 'application/json', - body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - }, - { body: 'I am an attachment' } - ] - } - }, - function (error, response, body) { - if (error) { - return console.error('upload failed:', error); - } - console.log('Upload successful! Server responded with:', body); - }) -``` - -[back to top](#table-of-contents) - - ---- - - -## HTTP Authentication - -```js -request.get('http://some.server.com/').auth('username', 'password', false); -// or -request.get('http://some.server.com/', { - 'auth': { - 'user': 'username', - 'pass': 'password', - 'sendImmediately': false - } -}); -// or -request.get('http://some.server.com/').auth(null, null, true, 'bearerToken'); -// or -request.get('http://some.server.com/', { - 'auth': { - 'bearer': 'bearerToken' - } -}); -``` - -If passed as an option, `auth` should be a hash containing values: - -- `user` || `username` -- `pass` || `password` -- `sendImmediately` (optional) -- `bearer` (optional) - -The method form takes parameters -`auth(username, password, sendImmediately, bearer)`. - -`sendImmediately` defaults to `true`, which causes a basic or bearer -authentication header to be sent. If `sendImmediately` is `false`, then -`request` will retry with a proper authentication header after receiving a -`401` response from the server (which must contain a `WWW-Authenticate` header -indicating the required authentication method). - -Note that you can also specify basic authentication using the URL itself, as -detailed in [RFC 1738](http://www.ietf.org/rfc/rfc1738.txt). Simply pass the -`user:password` before the host with an `@` sign: - -```js -const username = 'username', - password = 'password', - url = 'http://' + username + ':' + password + '@some.server.com'; - -request({url}, function (error, response, body) { - // Do more stuff with 'body' here -}); -``` - -Digest authentication is supported, but it only works with `sendImmediately` -set to `false`; otherwise `request` will send basic authentication on the -initial request, which will probably cause the request to fail. - -Bearer authentication is supported, and is activated when the `bearer` value is -available. The value may be either a `String` or a `Function` returning a -`String`. Using a function to supply the bearer token is particularly useful if -used in conjunction with `defaults` to allow a single function to supply the -last known token at the time of sending a request, or to compute one on the fly. - -[back to top](#table-of-contents) - - ---- - - -## Custom HTTP Headers - -HTTP Headers, such as `User-Agent`, can be set in the `options` object. -In the example below, we call the github API to find out the number -of stars and forks for the request repository. This requires a -custom `User-Agent` header as well as https. - -```js -const request = require('request'); - -const options = { - url: 'https://api.github.com/repos/cypress-io/request', - headers: { - 'User-Agent': 'request' - } -}; - -function callback(error, response, body) { - if (!error && response.statusCode == 200) { - const info = JSON.parse(body); - console.log(info.stargazers_count + " Stars"); - console.log(info.forks_count + " Forks"); - } -} - -request(options, callback); -``` - -[back to top](#table-of-contents) - - ---- - -## Proxies - -If you specify a `proxy` option, then the request (and any subsequent -redirects) will be sent via a connection to the proxy server. - -If your endpoint is an `https` url, and you are using a proxy, then -request will send a `CONNECT` request to the proxy server *first*, and -then use the supplied connection to connect to the endpoint. - -That is, first it will make a request like: - -``` -HTTP/1.1 CONNECT endpoint-server.com:80 -Host: proxy-server.com -User-Agent: whatever user agent you specify -``` - -and then the proxy server make a TCP connection to `endpoint-server` -on port `80`, and return a response that looks like: - -``` -HTTP/1.1 200 OK -``` - -At this point, the connection is left open, and the client is -communicating directly with the `endpoint-server.com` machine. - -See [the wikipedia page on HTTP Tunneling](https://en.wikipedia.org/wiki/HTTP_tunnel) -for more information. - -By default, when proxying `http` traffic, request will simply make a -standard proxied `http` request. This is done by making the `url` -section of the initial line of the request a fully qualified url to -the endpoint. - -For example, it will make a single request that looks like: - -``` -HTTP/1.1 GET http://endpoint-server.com/some-url -Host: proxy-server.com -Other-Headers: all go here - -request body or whatever -``` - -Because a pure "http over http" tunnel offers no additional security -or other features, it is generally simpler to go with a -straightforward HTTP proxy in this case. However, if you would like -to force a tunneling proxy, you may set the `tunnel` option to `true`. - -You can also make a standard proxied `http` request by explicitly setting -`tunnel : false`, but **note that this will allow the proxy to see the traffic -to/from the destination server**. - -If you are using a tunneling proxy, you may set the -`proxyHeaderWhiteList` to share certain headers with the proxy. - -You can also set the `proxyHeaderExclusiveList` to share certain -headers only with the proxy and not with destination host. - -By default, this set is: - -``` -accept -accept-charset -accept-encoding -accept-language -accept-ranges -cache-control -content-encoding -content-language -content-length -content-location -content-md5 -content-range -content-type -connection -date -expect -max-forwards -pragma -proxy-authorization -referer -te -transfer-encoding -user-agent -via -``` - -Note that, when using a tunneling proxy, the `proxy-authorization` -header and any headers from custom `proxyHeaderExclusiveList` are -*never* sent to the endpoint server, but only to the proxy server. - - -### Controlling proxy behaviour using environment variables - -The following environment variables are respected by `request`: - - * `HTTP_PROXY` / `http_proxy` - * `HTTPS_PROXY` / `https_proxy` - * `NO_PROXY` / `no_proxy` - -When `HTTP_PROXY` / `http_proxy` are set, they will be used to proxy non-SSL requests that do not have an explicit `proxy` configuration option present. Similarly, `HTTPS_PROXY` / `https_proxy` will be respected for SSL requests that do not have an explicit `proxy` configuration option. It is valid to define a proxy in one of the environment variables, but then override it for a specific request, using the `proxy` configuration option. Furthermore, the `proxy` configuration option can be explicitly set to false / null to opt out of proxying altogether for that request. - -`request` is also aware of the `NO_PROXY`/`no_proxy` environment variables. These variables provide a granular way to opt out of proxying, on a per-host basis. It should contain a comma separated list of hosts to opt out of proxying. It is also possible to opt of proxying when a particular destination port is used. Finally, the variable may be set to `*` to opt out of the implicit proxy configuration of the other environment variables. - -Here's some examples of valid `no_proxy` values: - - * `google.com` - don't proxy HTTP/HTTPS requests to Google. - * `google.com:443` - don't proxy HTTPS requests to Google, but *do* proxy HTTP requests to Google. - * `google.com:443, yahoo.com:80` - don't proxy HTTPS requests to Google, and don't proxy HTTP requests to Yahoo! - * `*` - ignore `https_proxy`/`http_proxy` environment variables altogether. - -[back to top](#table-of-contents) - - ---- - - -## UNIX Domain Sockets - -`request` supports making requests to [UNIX Domain Sockets](https://en.wikipedia.org/wiki/Unix_domain_socket). To make one, use the following URL scheme: - -```js -/* Pattern */ 'http://unix:SOCKET:PATH' -/* Example */ request.get('http://unix:/absolute/path/to/unix.socket:/request/path') -``` - -Note: The `SOCKET` path is assumed to be absolute to the root of the host file system. - -[back to top](#table-of-contents) - - ---- - - -## TLS/SSL Protocol - -TLS/SSL Protocol options, such as `cert`, `key` and `passphrase`, can be -set directly in `options` object, in the `agentOptions` property of the `options` object, or even in `https.globalAgent.options`. Keep in mind that, although `agentOptions` allows for a slightly wider range of configurations, the recommended way is via `options` object directly, as using `agentOptions` or `https.globalAgent.options` would not be applied in the same way in proxied environments (as data travels through a TLS connection instead of an http/https agent). - -```js -const fs = require('fs') - , path = require('path') - , certFile = path.resolve(__dirname, 'ssl/client.crt') - , keyFile = path.resolve(__dirname, 'ssl/client.key') - , caFile = path.resolve(__dirname, 'ssl/ca.cert.pem') - , request = require('request'); - -const options = { - url: 'https://api.some-server.com/', - cert: fs.readFileSync(certFile), - key: fs.readFileSync(keyFile), - passphrase: 'password', - ca: fs.readFileSync(caFile) -}; - -request.get(options); -``` - -### Using `options.agentOptions` - -In the example below, we call an API that requires client side SSL certificate -(in PEM format) with passphrase protected private key (in PEM format) and disable the SSLv3 protocol: - -```js -const fs = require('fs') - , path = require('path') - , certFile = path.resolve(__dirname, 'ssl/client.crt') - , keyFile = path.resolve(__dirname, 'ssl/client.key') - , request = require('request'); - -const options = { - url: 'https://api.some-server.com/', - agentOptions: { - cert: fs.readFileSync(certFile), - key: fs.readFileSync(keyFile), - // Or use `pfx` property replacing `cert` and `key` when using private key, certificate and CA certs in PFX or PKCS12 format: - // pfx: fs.readFileSync(pfxFilePath), - passphrase: 'password', - securityOptions: 'SSL_OP_NO_SSLv3' - } -}; - -request.get(options); -``` - -It is able to force using SSLv3 only by specifying `secureProtocol`: - -```js -request.get({ - url: 'https://api.some-server.com/', - agentOptions: { - secureProtocol: 'SSLv3_method' - } -}); -``` - -It is possible to accept other certificates than those signed by generally allowed Certificate Authorities (CAs). -This can be useful, for example, when using self-signed certificates. -To require a different root certificate, you can specify the signing CA by adding the contents of the CA's certificate file to the `agentOptions`. -The certificate the domain presents must be signed by the root certificate specified: - -```js -request.get({ - url: 'https://api.some-server.com/', - agentOptions: { - ca: fs.readFileSync('ca.cert.pem') - } -}); -``` - -The `ca` value can be an array of certificates, in the event you have a private or internal corporate public-key infrastructure hierarchy. For example, if you want to connect to https://api.some-server.com which presents a key chain consisting of: -1. its own public key, which is signed by: -2. an intermediate "Corp Issuing Server", that is in turn signed by: -3. a root CA "Corp Root CA"; - -you can configure your request as follows: - -```js -request.get({ - url: 'https://api.some-server.com/', - agentOptions: { - ca: [ - fs.readFileSync('Corp Issuing Server.pem'), - fs.readFileSync('Corp Root CA.pem') - ] - } -}); -``` - -[back to top](#table-of-contents) - - ---- - -## Support for HAR 1.2 - -The `options.har` property will override the values: `url`, `method`, `qs`, `headers`, `form`, `formData`, `body`, `json`, as well as construct multipart data and read files from disk when `request.postData.params[].fileName` is present without a matching `value`. - -A validation step will check if the HAR Request format matches the latest spec (v1.2) and will skip parsing if not matching. - -```js - const request = require('request') - request({ - // will be ignored - method: 'GET', - uri: 'http://www.google.com', - - // HTTP Archive Request Object - har: { - url: 'http://www.mockbin.com/har', - method: 'POST', - headers: [ - { - name: 'content-type', - value: 'application/x-www-form-urlencoded' - } - ], - postData: { - mimeType: 'application/x-www-form-urlencoded', - params: [ - { - name: 'foo', - value: 'bar' - }, - { - name: 'hello', - value: 'world' - } - ] - } - } - }) - - // a POST request will be sent to http://www.mockbin.com - // with body an application/x-www-form-urlencoded body: - // foo=bar&hello=world -``` - -[back to top](#table-of-contents) - - ---- - -## request(options, callback) - -The first argument can be either a `url` or an `options` object. The only required option is `uri`; all others are optional. - -- `uri` || `url` - fully qualified uri or a parsed url object from `url.parse()` -- `baseUrl` - fully qualified uri string used as the base url. Most useful with `request.defaults`, for example when you want to do many requests to the same domain. If `baseUrl` is `https://example.com/api/`, then requesting `/end/point?test=true` will fetch `https://example.com/api/end/point?test=true`. When `baseUrl` is given, `uri` must also be a string. -- `method` - http method (default: `"GET"`) -- `headers` - http headers (default: `{}`) - ---- - -- `qs` - object containing querystring values to be appended to the `uri` -- `qsParseOptions` - object containing options to pass to the [qs.parse](/~https://github.com/hapijs/qs#parsing-objects) method. Alternatively pass options to the [querystring.parse](https://nodejs.org/docs/v0.12.0/api/querystring.html#querystring_querystring_parse_str_sep_eq_options) method using this format `{sep:';', eq:':', options:{}}` -- `qsStringifyOptions` - object containing options to pass to the [qs.stringify](/~https://github.com/hapijs/qs#stringifying) method. Alternatively pass options to the [querystring.stringify](https://nodejs.org/docs/v0.12.0/api/querystring.html#querystring_querystring_stringify_obj_sep_eq_options) method using this format `{sep:';', eq:':', options:{}}`. For example, to change the way arrays are converted to query strings using the `qs` module pass the `arrayFormat` option with one of `indices|brackets|repeat` -- `useQuerystring` - if true, use `querystring` to stringify and parse - querystrings, otherwise use `qs` (default: `false`). Set this option to - `true` if you need arrays to be serialized as `foo=bar&foo=baz` instead of the - default `foo[0]=bar&foo[1]=baz`. - ---- - -- `body` - entity body for PATCH, POST and PUT requests. Must be a `Buffer`, `String` or `ReadStream`. If `json` is `true`, then `body` must be a JSON-serializable object. -- `form` - when passed an object or a querystring, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded` header. When passed no options, a `FormData` instance is returned (and is piped to request). See "Forms" section above. -- `formData` - data to pass for a `multipart/form-data` request. See - [Forms](#forms) section above. -- `multipart` - array of objects which contain their own headers and `body` - attributes. Sends a `multipart/related` request. See [Forms](#forms) section - above. - - Alternatively you can pass in an object `{chunked: false, data: []}` where - `chunked` is used to specify whether the request is sent in - [chunked transfer encoding](https://en.wikipedia.org/wiki/Chunked_transfer_encoding) - In non-chunked requests, data items with body streams are not allowed. -- `preambleCRLF` - append a newline/CRLF before the boundary of your `multipart/form-data` request. -- `postambleCRLF` - append a newline/CRLF at the end of the boundary of your `multipart/form-data` request. -- `json` - sets `body` to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON. -- `jsonReviver` - a [reviver function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) that will be passed to `JSON.parse()` when parsing a JSON response body. -- `jsonReplacer` - a [replacer function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) that will be passed to `JSON.stringify()` when stringifying a JSON request body. - ---- - -- `auth` - a hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). See documentation above. -- `hawk` - options for [Hawk signing](/~https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](/~https://github.com/hueniverse/hawk#usage-example). -- `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`, and optionally `session` (note that this only works for services that require session as part of the canonical string). Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services). If you want to use AWS sign version 4 use the parameter `sign_version` with value `4` otherwise the default is version 2. If you are using SigV4, you can also include a `service` property that specifies the service name. **Note:** you need to `npm install aws4` first. -- `httpSignature` - options for the [HTTP Signature Scheme](/~https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](/~https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options. - ---- - -- `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`). This property can also be implemented as function which gets `response` object as the first argument. - - *(synchronous usage)* It should return `true` if redirects should continue or `false` otherwise. If it returns a url string, the destination of the redirect will be overridden. - - *(async callback usage)* If the function has two arguments, it will be treated as an asynchronous function and will be passed a callback as the second argument. Invoke the callback with an error (`null` if no error) and the boolean/url result as the second. - - *(async promise usage)* Return a promise that resolves to the boolean/url result. -- `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects (default: `false`) -- `followOriginalHttpMethod` - by default we redirect to HTTP method GET. you can enable this property to redirect to the original HTTP method (default: `false`) -- `maxRedirects` - the maximum number of redirects to follow (default: `10`) -- `removeRefererHeader` - removes the referer header when a redirect happens (default: `false`). **Note:** if true, referer header set in the initial request is preserved during redirect chain. -- `allowInsecureRedirect` - allows cross-protocol redirects (HTTP to HTTPS and vice versa). **Warning:** may lead to bypassing anti SSRF filters (default: `false`) - ---- - -- `encoding` - encoding to be used on `setEncoding` of response data. If `null`, the `body` is returned as a `Buffer`. Anything else **(including the default value of `undefined`)** will be passed as the [encoding](http://nodejs.org/api/buffer.html#buffer_buffer) parameter to `toString()` (meaning this is effectively `utf8` by default). (**Note:** if you expect binary data, you should set `encoding: null`.) -- `gzip` - if `true`, add an `Accept-Encoding` header to request compressed content encodings from the server (if not already present) and decode supported content encodings in the response. **Note:** Automatic decoding of the response content is performed on the body data returned through `request` (both through the `request` stream and passed to the callback function) but is not performed on the `response` stream (available from the `response` event) which is the unmodified `http.IncomingMessage` object which may contain compressed data. See example below. -- `jar` - if `true`, remember cookies for future use (or define your custom cookie jar; see examples section) - ---- - -- `agent` - `http(s).Agent` instance to use -- `agentClass` - alternatively specify your agent's class name -- `agentOptions` - and pass its options. **Note:** for HTTPS see [tls API doc for TLS/SSL options](http://nodejs.org/api/tls.html#tls_tls_connect_options_callback) and the [documentation above](#using-optionsagentoptions). -- `forever` - set to `true` to use the [forever-agent](/~https://github.com/request/forever-agent) **Note:** Defaults to `http(s).Agent({keepAlive:true})` in node 0.12+ -- `pool` - an object describing which agents to use for the request. If this option is omitted the request will use the global agent (as long as your options allow for it). Otherwise, request will search the pool for your custom agent. If no custom agent is found, a new agent will be created and added to the pool. **Note:** `pool` is used only when the `agent` option is not specified. - - A `maxSockets` property can also be provided on the `pool` object to set the max number of sockets for all agents created (ex: `pool: {maxSockets: Infinity}`). - - Note that if you are sending multiple requests in a loop and creating - multiple new `pool` objects, `maxSockets` will not work as intended. To - work around this, either use [`request.defaults`](#requestdefaultsoptions) - with your pool options or create the pool object with the `maxSockets` - property outside of the loop. -- `timeout` - integer containing number of milliseconds, controls two timeouts. - - **Read timeout**: Time to wait for a server to send response headers (and start the response body) before aborting the request. - - **Connection timeout**: Sets the socket to timeout after `timeout` milliseconds of inactivity. Note that increasing the timeout beyond the OS-wide TCP connection timeout will not have any effect ([the default in Linux can be anywhere from 20-120 seconds][linux-timeout]) - -[linux-timeout]: http://www.sekuda.com/overriding_the_default_linux_kernel_20_second_tcp_socket_connect_timeout - ---- - -- `localAddress` - local interface to bind for network connections. -- `proxy` - an HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for the `url` parameter (by embedding the auth info in the `uri`) -- `strictSSL` - if `true`, requires SSL certificates be valid. **Note:** to use your own certificate authority, you need to specify an agent that was created with that CA as an option. -- `tunnel` - controls the behavior of - [HTTP `CONNECT` tunneling](https://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_tunneling) - as follows: - - `undefined` (default) - `true` if the destination is `https`, `false` otherwise - - `true` - always tunnel to the destination by making a `CONNECT` request to - the proxy - - `false` - request the destination as a `GET` request. -- `proxyHeaderWhiteList` - a whitelist of headers to send to a - tunneling proxy. -- `proxyHeaderExclusiveList` - a whitelist of headers to send - exclusively to a tunneling proxy and not to destination. - ---- - -- `time` - if `true`, the request-response cycle (including all redirects) is timed at millisecond resolution. When set, the following properties are added to the response object: - - `elapsedTime` Duration of the entire request/response in milliseconds (*deprecated*). - - `responseStartTime` Timestamp when the response began (in Unix Epoch milliseconds) (*deprecated*). - - `timingStart` Timestamp of the start of the request (in Unix Epoch milliseconds). - - `timings` Contains event timestamps in millisecond resolution relative to `timingStart`. If there were redirects, the properties reflect the timings of the final request in the redirect chain: - - `socket` Relative timestamp when the [`http`](https://nodejs.org/api/http.html#http_event_socket) module's `socket` event fires. This happens when the socket is assigned to the request. - - `lookup` Relative timestamp when the [`net`](https://nodejs.org/api/net.html#net_event_lookup) module's `lookup` event fires. This happens when the DNS has been resolved. - - `connect`: Relative timestamp when the [`net`](https://nodejs.org/api/net.html#net_event_connect) module's `connect` event fires. This happens when the server acknowledges the TCP connection. - - `response`: Relative timestamp when the [`http`](https://nodejs.org/api/http.html#http_event_response) module's `response` event fires. This happens when the first bytes are received from the server. - - `end`: Relative timestamp when the last bytes of the response are received. - - `timingPhases` Contains the durations of each request phase. If there were redirects, the properties reflect the timings of the final request in the redirect chain: - - `wait`: Duration of socket initialization (`timings.socket`) - - `dns`: Duration of DNS lookup (`timings.lookup` - `timings.socket`) - - `tcp`: Duration of TCP connection (`timings.connect` - `timings.socket`) - - `firstByte`: Duration of HTTP server response (`timings.response` - `timings.connect`) - - `download`: Duration of HTTP download (`timings.end` - `timings.response`) - - `total`: Duration entire HTTP round-trip (`timings.end`) - -- `har` - a [HAR 1.2 Request Object](http://www.softwareishard.com/blog/har-12-spec/#request), will be processed from HAR format into options overwriting matching values *(see the [HAR 1.2 section](#support-for-har-12) for details)* -- `callback` - alternatively pass the request's callback in the options object - -The callback argument gets 3 arguments: - -1. An `error` when applicable (usually from [`http.ClientRequest`](http://nodejs.org/api/http.html#http_class_http_clientrequest) object) -2. An [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) object (Response object) -3. The third is the `response` body (`String` or `Buffer`, or JSON object if the `json` option is supplied) - -[back to top](#table-of-contents) - - ---- - -## Convenience methods - -There are also shorthand methods for different HTTP METHODs and some other conveniences. - - -### request.defaults(options) - -This method **returns a wrapper** around the normal request API that defaults -to whatever options you pass to it. - -**Note:** `request.defaults()` **does not** modify the global request API; -instead, it **returns a wrapper** that has your default settings applied to it. - -**Note:** You can call `.defaults()` on the wrapper that is returned from -`request.defaults` to add/override defaults that were previously defaulted. - -For example: -```js -//requests using baseRequest() will set the 'x-token' header -const baseRequest = request.defaults({ - headers: {'x-token': 'my-token'} -}) - -//requests using specialRequest() will include the 'x-token' header set in -//baseRequest and will also include the 'special' header -const specialRequest = baseRequest.defaults({ - headers: {special: 'special value'} -}) -``` - -### request.METHOD() - -These HTTP method convenience functions act just like `request()` but with a default method already set for you: - -- *request.get()*: Defaults to `method: "GET"`. -- *request.post()*: Defaults to `method: "POST"`. -- *request.put()*: Defaults to `method: "PUT"`. -- *request.patch()*: Defaults to `method: "PATCH"`. -- *request.del() / request.delete()*: Defaults to `method: "DELETE"`. -- *request.head()*: Defaults to `method: "HEAD"`. -- *request.options()*: Defaults to `method: "OPTIONS"`. - -### request.cookie() - -Function that creates a new cookie. - -```js -request.cookie('key1=value1') -``` -### request.jar() - -Function that creates a new cookie jar. - -```js -request.jar() -``` - -### response.caseless.get('header-name') - -Function that returns the specified response header field using a [case-insensitive match](https://tools.ietf.org/html/rfc7230#section-3.2) - -```js -request('http://www.google.com', function (error, response, body) { - // print the Content-Type header even if the server returned it as 'content-type' (lowercase) - console.log('Content-Type is:', response.caseless.get('Content-Type')); -}); -``` - -[back to top](#table-of-contents) - - ---- - - -## Debugging - -There are at least three ways to debug the operation of `request`: - -1. Launch the node process like `NODE_DEBUG=request node script.js` - (`lib,request,otherlib` works too). - -2. Set `require('request').debug = true` at any time (this does the same thing - as #1). - -3. Use the [request-debug module](/~https://github.com/cypress-io/request-debug) to - view request and response headers and bodies. - -[back to top](#table-of-contents) - - ---- - -## Timeouts - -Most requests to external servers should have a timeout attached, in case the -server is not responding in a timely manner. Without a timeout, your code may -have a socket open/consume resources for minutes or more. - -There are two main types of timeouts: **connection timeouts** and **read -timeouts**. A connect timeout occurs if the timeout is hit while your client is -attempting to establish a connection to a remote machine (corresponding to the -[connect() call][connect] on the socket). A read timeout occurs any time the -server is too slow to send back a part of the response. - -These two situations have widely different implications for what went wrong -with the request, so it's useful to be able to distinguish them. You can detect -timeout errors by checking `err.code` for an 'ETIMEDOUT' value. Further, you -can detect whether the timeout was a connection timeout by checking if the -`err.connect` property is set to `true`. - -```js -request.get('http://10.255.255.1', {timeout: 1500}, function(err) { - console.log(err.code === 'ETIMEDOUT'); - // Set to `true` if the timeout was a connection timeout, `false` or - // `undefined` otherwise. - console.log(err.connect === true); - process.exit(0); -}); -``` - -[connect]: http://linux.die.net/man/2/connect - -## Examples: - -```js - const request = require('request') - , rand = Math.floor(Math.random()*100000000).toString() - ; - request( - { method: 'PUT' - , uri: 'http://mikeal.iriscouch.com/testjs/' + rand - , multipart: - [ { 'content-type': 'application/json' - , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - } - , { body: 'I am an attachment' } - ] - } - , function (error, response, body) { - if(response.statusCode == 201){ - console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) - } else { - console.log('error: '+ response.statusCode) - console.log(body) - } - } - ) -``` - -For backwards-compatibility, response compression is not supported by default. -To accept gzip-compressed responses, set the `gzip` option to `true`. Note -that the body data passed through `request` is automatically decompressed -while the response object is unmodified and will contain compressed data if -the server sent a compressed response. - -```js - const request = require('request') - request( - { method: 'GET' - , uri: 'http://www.google.com' - , gzip: true - } - , function (error, response, body) { - // body is the decompressed response body - console.log('server encoded the data as: ' + (response.headers['content-encoding'] || 'identity')) - console.log('the decoded data is: ' + body) - } - ) - .on('data', function(data) { - // decompressed data as it is received - console.log('decoded chunk: ' + data) - }) - .on('response', function(response) { - // unmodified http.IncomingMessage object - response.on('data', function(data) { - // compressed data as it is received - console.log('received ' + data.length + ' bytes of compressed data') - }) - }) -``` - -Cookies are disabled by default (else, they would be used in subsequent requests). To enable cookies, set `jar` to `true` (either in `defaults` or `options`). - -```js -const request = request.defaults({jar: true}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` - -To use a custom cookie jar (instead of `request`’s global cookie jar), set `jar` to an instance of `request.jar()` (either in `defaults` or `options`) - -```js -const j = request.jar() -const request = request.defaults({jar:j}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` - -OR - -```js -const j = request.jar(); -const cookie = request.cookie('key1=value1'); -const url = 'http://www.google.com'; -j.setCookie(cookie, url); -request({url: url, jar: j}, function () { - request('http://images.google.com') -}) -``` - -To use a custom cookie store (such as a -[`FileCookieStore`](/~https://github.com/mitsuru/tough-cookie-filestore) -which supports saving to and restoring from JSON files), pass it as a parameter -to `request.jar()`: - -```js -const FileCookieStore = require('tough-cookie-filestore'); -// NOTE - currently the 'cookies.json' file must already exist! -const j = request.jar(new FileCookieStore('cookies.json')); -request = request.defaults({ jar : j }) -request('http://www.google.com', function() { - request('http://images.google.com') -}) -``` - -The cookie store must be a -[`tough-cookie`](/~https://github.com/SalesforceEng/tough-cookie) -store and it must support synchronous operations; see the -[`CookieStore` API docs](/~https://github.com/SalesforceEng/tough-cookie#api) -for details. - -To inspect your cookie jar after a request: - -```js -const j = request.jar() -request({url: 'http://www.google.com', jar: j}, function () { - const cookie_string = j.getCookieString(url); // "key1=value1; key2=value2; ..." - const cookies = j.getCookies(url); - // [{key: 'key1', value: 'value1', domain: "www.google.com", ...}, ...] -}) -``` - -[back to top](#table-of-contents) +**This is a fork of [`request`](/~https://github.com/request/request) for use in [Cypress](/~https://github.com/cypress-io/cypress). This repo is not intended for outside use.** diff --git a/examples/README.md b/examples/README.md deleted file mode 100644 index caa34053b..000000000 --- a/examples/README.md +++ /dev/null @@ -1,89 +0,0 @@ - -# Authentication - -# Multipart - -## multipart/form-data - -### Flickr Image Upload - -- https://www.flickr.com/services/api/upload.api.html - -```js -request.post('https://up.flickr.com/services/upload', { - // all meta data should be included here for proper signing - qs: { - title: 'My cat is awesome', - description: 'Sent on ' + new Date(), - is_public: 1 - }, - // again the same meta data + the actual photo - formData: { - title: 'My cat is awesome', - description: 'Sent on ' + new Date(), - is_public: 1, - photo:fs.createReadStream('cat.png') - }, - json: true -}, function (err, res, body) { - // assert.equal(typeof body, 'object') -}) -``` - -# Streams - -## `POST` data - -Use Request as a Writable stream to easily `POST` Readable streams (like files, other HTTP requests, or otherwise). - -TL;DR: Pipe a Readable Stream onto Request via: - -``` -READABLE.pipe(request.post(URL)); -``` - -A more detailed example: - -```js -var fs = require('fs') - , path = require('path') - , http = require('http') - , request = require('request') - , TMP_FILE_PATH = path.join(path.sep, 'tmp', 'foo') -; - -// write a temporary file: -fs.writeFileSync(TMP_FILE_PATH, 'foo bar baz quk\n'); - -http.createServer(function(req, res) { - console.log('the server is receiving data!\n'); - req - .on('end', res.end.bind(res)) - .pipe(process.stdout) - ; -}).listen(3000).unref(); - -fs.createReadStream(TMP_FILE_PATH) - .pipe(request.post('http://127.0.0.1:3000')) -; -``` - -# Proxys - -Run tor on the terminal and try the following. (Needs `socks5-http-client` to connect to tor) - -```js -var request = require('../index.js'); -var Agent = require('socks5-http-client/lib/Agent'); - -request.get({ - url: 'http://www.tenreads.io', - agentClass: Agent, - agentOptions: { - socksHost: 'localhost', // Defaults to 'localhost'. - socksPort: 9050 // Defaults to 1080. - } -}, function (err, res) { - console.log(res.body); -}); -``` diff --git a/index.js b/index.js index d50f9917b..e68cc3246 100755 --- a/index.js +++ b/index.js @@ -1,17 +1,3 @@ -// Copyright 2010-2012 Mikeal Rogers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - 'use strict' var extend = require('extend') diff --git a/package.json b/package.json index 6b252dce0..5d4b12f30 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,7 @@ { "name": "@cypress/request", "description": "Cypress's fork of a simplified HTTP request client.", - "keywords": [ - "http", - "simple", - "util", - "utility" - ], "version": "0.0.0-development", - "author": "Mikeal Rogers ", "repository": { "type": "git", "url": "/~https://github.com/cypress-io/request.git" @@ -16,9 +9,8 @@ "bugs": { "url": "http://github.com/cypress-io/request/issues" }, - "license": "Apache-2.0", "engines": { - "node": ">= 6" + "node": ">= 18" }, "main": "index.js", "files": [ @@ -74,11 +66,5 @@ "standard": "^9.0.0", "tap": "^15.1.5", "tape": "^4.6.0" - }, - "greenkeeper": { - "ignore": [ - "hawk", - "har-validator" - ] } }