diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index 22cf9023cc699..36cb9ee28615c 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -71,6 +71,7 @@ "gatsby-react-router-scroll": "^2.0.7", "gatsby-telemetry": "^1.0.7", "glob": "^7.1.1", + "got": "8.0.0", "graphql": "^14.1.1", "graphql-compose": "6.0.3", "graphql-playground-middleware-express": "^1.7.10", @@ -108,7 +109,6 @@ "react-error-overlay": "^3.0.0", "react-hot-loader": "^4.6.2", "redux": "^4.0.0", - "request": "^2.85.0", "semver": "^5.6.0", "shallow-compare": "^1.2.2", "sift": "^5.1.0", diff --git a/packages/gatsby/src/commands/develop.js b/packages/gatsby/src/commands/develop.js index 8e9d08c91a5b4..052d3d0513452 100644 --- a/packages/gatsby/src/commands/develop.js +++ b/packages/gatsby/src/commands/develop.js @@ -10,7 +10,7 @@ const graphqlHTTP = require(`express-graphql`) const graphqlPlayground = require(`graphql-playground-middleware-express`) .default const { formatError } = require(`graphql`) -const request = require(`request`) +const got = require(`got`) const rl = require(`readline`) const webpack = require(`webpack`) const webpackConfig = require(`../utils/webpack.config`) @@ -210,7 +210,7 @@ async function startServer(program) { const proxiedUrl = url + req.originalUrl req .pipe( - request(proxiedUrl).on(`error`, err => { + got.stream(proxiedUrl).on(`error`, err => { const message = `Error when trying to proxy request "${ req.originalUrl }" to "${proxiedUrl}"` diff --git a/yarn.lock b/yarn.lock index ef5208b938766..5d939fc210db6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10187,6 +10187,30 @@ googleapis@^29.0.0: url-template "^2.0.8" uuid "^3.2.1" +got@8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/got/-/got-8.0.0.tgz#57a11f841edc58e3f3eba4b3ac220faf5133770f" + integrity sha512-lqVA9ORcSGfJPHfMXh1RW451aYMP1NyXivpGqGggnfDqNz3QVfMl7MkuEz+dr70gK2X8dhLiS5YzHhCV3/3yOQ== + dependencies: + cacheable-request "^2.1.1" + decompress-response "^3.3.0" + duplexer3 "^0.1.4" + get-stream "^3.0.0" + into-stream "^3.1.0" + is-plain-obj "^1.1.0" + is-retry-allowed "^1.1.0" + is-stream "^1.1.0" + isurl "^1.0.0-alpha5" + lowercase-keys "^1.0.0" + mimic-response "^1.0.0" + p-cancelable "^0.3.0" + p-timeout "^1.2.0" + pify "^3.0.0" + safe-buffer "^5.1.1" + timed-out "^4.0.1" + url-parse-lax "^3.0.0" + url-to-options "^1.0.1" + got@^6.7.1: version "6.7.1" resolved "http://registry.npmjs.org/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0" @@ -15728,7 +15752,7 @@ p-some@^2.0.0: dependencies: aggregate-error "^1.0.0" -p-timeout@^1.0.0, p-timeout@^1.1.1: +p-timeout@^1.0.0, p-timeout@^1.1.1, p-timeout@^1.2.0: version "1.2.1" resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-1.2.1.tgz#5eb3b353b7fce99f101a1038880bb054ebbea386" integrity sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=