Skip to content

Commit

Permalink
chore(gatsby): change HTTP request library from request to got fo…
Browse files Browse the repository at this point in the history
…r future support (gatsbyjs#13434)

* change request library from `request` to `got` for future support

* remove console statement

* use a compatible version of got
  • Loading branch information
ryandrew14 authored and sidharthachatterjee committed Apr 18, 2019
1 parent 616f63b commit aca58b7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby/src/commands/develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down Expand Up @@ -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}"`
Expand Down
26 changes: 25 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10187,6 +10187,30 @@ googleapis@^29.0.0:
url-template "^2.0.8"
uuid "^3.2.1"

[email protected]:
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"
Expand Down Expand Up @@ -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=
Expand Down

0 comments on commit aca58b7

Please sign in to comment.