Skip to content

Commit

Permalink
feat(gatsby-source-wordpress): Fix false positive error if the URL an…
Browse files Browse the repository at this point in the history
…d the responsePath are the same (#31612)

It is possible to get this output from the response:
{
  responsePath: 'https://<xxx>/graphql',
  path: '/graphql',
  url: 'https://<xxx>/graphql'
}
instead of
{
  responsePath: '/graphql',
  path: '/graphql',
  url: 'https://<xxx>/graphql'
}

It doesn't make sense to reject the request with GraphQL request was redirected
as the responsePath _is_ the url.
  • Loading branch information
dhoko committed May 28, 2021
1 parent 47a8577 commit cca71cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/gatsby-source-wordpress/src/utils/fetch-graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,11 @@ const fetchGraphql = async ({

const responsePath = response.request.path

if (path !== responsePath && responsePath !== undefined) {
if (
path !== responsePath &&
responsePath !== undefined &&
responsePath !== url
) {
throw new Error(`GraphQL request was redirected to ${responsePath}`)
}

Expand Down

0 comments on commit cca71cf

Please sign in to comment.