Skip to content

Commit aca58b7

Browse files
ryandrew14sidharthachatterjee
authored andcommitted
chore(gatsby): change HTTP request library from request to got for future support (#13434)
* change request library from `request` to `got` for future support * remove console statement * use a compatible version of got
1 parent 616f63b commit aca58b7

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

packages/gatsby/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"gatsby-react-router-scroll": "^2.0.7",
7272
"gatsby-telemetry": "^1.0.7",
7373
"glob": "^7.1.1",
74+
"got": "8.0.0",
7475
"graphql": "^14.1.1",
7576
"graphql-compose": "6.0.3",
7677
"graphql-playground-middleware-express": "^1.7.10",
@@ -108,7 +109,6 @@
108109
"react-error-overlay": "^3.0.0",
109110
"react-hot-loader": "^4.6.2",
110111
"redux": "^4.0.0",
111-
"request": "^2.85.0",
112112
"semver": "^5.6.0",
113113
"shallow-compare": "^1.2.2",
114114
"sift": "^5.1.0",

packages/gatsby/src/commands/develop.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const graphqlHTTP = require(`express-graphql`)
1010
const graphqlPlayground = require(`graphql-playground-middleware-express`)
1111
.default
1212
const { formatError } = require(`graphql`)
13-
const request = require(`request`)
13+
const got = require(`got`)
1414
const rl = require(`readline`)
1515
const webpack = require(`webpack`)
1616
const webpackConfig = require(`../utils/webpack.config`)
@@ -210,7 +210,7 @@ async function startServer(program) {
210210
const proxiedUrl = url + req.originalUrl
211211
req
212212
.pipe(
213-
request(proxiedUrl).on(`error`, err => {
213+
got.stream(proxiedUrl).on(`error`, err => {
214214
const message = `Error when trying to proxy request "${
215215
req.originalUrl
216216
}" to "${proxiedUrl}"`

yarn.lock

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10187,6 +10187,30 @@ googleapis@^29.0.0:
1018710187
url-template "^2.0.8"
1018810188
uuid "^3.2.1"
1018910189

10190+
10191+
version "8.0.0"
10192+
resolved "https://registry.yarnpkg.com/got/-/got-8.0.0.tgz#57a11f841edc58e3f3eba4b3ac220faf5133770f"
10193+
integrity sha512-lqVA9ORcSGfJPHfMXh1RW451aYMP1NyXivpGqGggnfDqNz3QVfMl7MkuEz+dr70gK2X8dhLiS5YzHhCV3/3yOQ==
10194+
dependencies:
10195+
cacheable-request "^2.1.1"
10196+
decompress-response "^3.3.0"
10197+
duplexer3 "^0.1.4"
10198+
get-stream "^3.0.0"
10199+
into-stream "^3.1.0"
10200+
is-plain-obj "^1.1.0"
10201+
is-retry-allowed "^1.1.0"
10202+
is-stream "^1.1.0"
10203+
isurl "^1.0.0-alpha5"
10204+
lowercase-keys "^1.0.0"
10205+
mimic-response "^1.0.0"
10206+
p-cancelable "^0.3.0"
10207+
p-timeout "^1.2.0"
10208+
pify "^3.0.0"
10209+
safe-buffer "^5.1.1"
10210+
timed-out "^4.0.1"
10211+
url-parse-lax "^3.0.0"
10212+
url-to-options "^1.0.1"
10213+
1019010214
got@^6.7.1:
1019110215
version "6.7.1"
1019210216
resolved "http://registry.npmjs.org/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0"
@@ -15728,7 +15752,7 @@ p-some@^2.0.0:
1572815752
dependencies:
1572915753
aggregate-error "^1.0.0"
1573015754

15731-
p-timeout@^1.0.0, p-timeout@^1.1.1:
15755+
p-timeout@^1.0.0, p-timeout@^1.1.1, p-timeout@^1.2.0:
1573215756
version "1.2.1"
1573315757
resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-1.2.1.tgz#5eb3b353b7fce99f101a1038880bb054ebbea386"
1573415758
integrity sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=

0 commit comments

Comments
 (0)