Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(createRemoteFileNode): allow passing headers to request #11682

Merged
merged 5 commits into from
Apr 5, 2019

Conversation

iFlameing
Copy link
Contributor

@iFlameing iFlameing commented Feb 10, 2019

Description

This allows a user to pass header to create-remote-file-node for fetching data which is in private mode in cms.

thanks to @datakurre who also helped me in creating this pr.

@iFlameing
Copy link
Contributor Author

@pieh can you review this?

@iFlameing
Copy link
Contributor Author

@pieh I think it needs review once again.

@iFlameing
Copy link
Contributor Author

@pieh can you review this? this is quiet simple.

@datakurre
Copy link
Contributor

datakurre commented Mar 14, 2019

@iFlameing Unfortunately, you need to rebase this.

It also seems that passing headers forward from requestRemoteNode has now been fixed in master, so renaming headers to requestArgs is no longer required. So, IMO this fix could be even simpler (just replacing const headers = {} with that headers argument).

@iFlameing
Copy link
Contributor Author

@datakurre once I get a reply from @wardpeet I will rebase this pr and do the necessary changes as you said.

@iFlameing
Copy link
Contributor Author

@datakurre I rebased the pr and modified the changes as you suggested. Please take a look!

@iFlameing
Copy link
Contributor Author

@pieh, please! review this once again.

@pieh pieh self-assigned this Apr 3, 2019
@pieh
Copy link
Contributor

pieh commented Apr 3, 2019

I think this looks good, but I didn't actually tested as I don't have anything that require some specific headers to download files - so to merge I need some example to test against

@iFlameing
Copy link
Contributor Author

@pieh We already tested this for downloading private images from Plone Source. Here is the link of issue where we tested it collective/gatsby-source-plone#162.

@pieh pieh changed the title Adding header(we can pass token) in create-remote-file-node feat(createRemoteFileNode): allow passing headers to request Apr 4, 2019
@wardpeet wardpeet assigned wardpeet and unassigned pieh Apr 5, 2019
@wardpeet
Copy link
Contributor

wardpeet commented Apr 5, 2019

i'll test with a simple glitch site.

Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with https://judicious-dinghy.glitch.me/secret & https://github.com/gatsbyjs/gatsby/tree/master/examples/using-gatsby-image it works as expected. When the authorization header is not present I get a no access image and else I get authorized!

@wardpeet wardpeet merged commit 7a8e41a into gatsbyjs:master Apr 5, 2019
@gatsbot
Copy link

gatsbot bot commented Apr 5, 2019

Holy buckets, @iFlameing — we just merged your PR to Gatsby! 💪💜

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (Currently we’ve got a couple t-shirts available, plus some socks that are really razzing our berries right now.)
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. Accept the invite by visiting https://github.com/orgs/gatsbyjs/invitation. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again!

@iFlameing iFlameing deleted the header branch April 5, 2019 16:51
@sidharthachatterjee
Copy link
Contributor

Published in gatsby-source-filesystem@2.0.29

mwfrost pushed a commit to mwfrost/gatsby that referenced this pull request Apr 20, 2023
…s#11682)

## Description
This allows a user to pass header to create-remote-file-node for fetching data which is in private mode in cms.

thanks to @datakurre who also helped me in creating this pr.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants