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

switch to ClientRequest so we have better control #115

Merged
merged 2 commits into from
Mar 2, 2018

Conversation

craig-day
Copy link
Contributor

@craig-day craig-day commented Mar 2, 2018

This PR switches from the isomorphic-fetch library to the native http and https modules to give us more control over request configuration.

The fetch library operates under the assumption its in the browser which means it doesn't allow certain headers to be set like Host, Cookie or User-Agent. Since this is an electron app, we don't have the same limitations.

I believe this PR will also resolve #112 and close #62

/cc @skevy @gjtorikian

@craig-day
Copy link
Contributor Author

fyi @ThisIsMissEm and @rmosolgo I believe this resolves your issues

"radium": "^0.14.1",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-modal": "^2.0.2",
"uuid": "^3.1.0",
"prop-types": "^15.6.0"
"uuid": "^3.1.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice

@gjtorikian
Copy link
Collaborator

With this change, I'm suddenly seeing an error:

Protocol "https:" not supported. Expected "http:"

Could you verify that? This was just from making a simple query to https://api.github.com/graphql.

@ThisIsMissEm
Copy link

I don't have time to test this, but the description sounds correct & like it'd fix the issue.

@craig-day
Copy link
Contributor Author

Ah @gjtorikian yeah looks like thats a problem. Turns out its because I'm using the ClientRequest from the http library, and not the one linked in the README from the electron API. Now I have to figure out how to get electrons net object into the react app.

I would reach out to window and do const { net } = window.require('electron') but that feels messy.

@craig-day
Copy link
Contributor Author

alright @gjtorikian after some digging, I got both http and https requests working, and I brought back the error handling that I unintentionally removed.

@gjtorikian
Copy link
Collaborator

Great, thank you! Release forthcoming.

@gjtorikian gjtorikian merged commit a7787d2 into skevy:master Mar 2, 2018
@craig-day
Copy link
Contributor Author

awesome. Thanks for the quick turnaround!

@craig-day craig-day deleted the craig-day/host_header branch March 2, 2018 22:04
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.

GraphiQL.app ignores the cookie header silently Allow override of User-Agent header?
3 participants