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

[Spike] Test node/electron with the HTTP-API (Windows) #2618

Closed
gbraad opened this issue Jul 30, 2021 · 4 comments
Closed

[Spike] Test node/electron with the HTTP-API (Windows) #2618

gbraad opened this issue Jul 30, 2021 · 4 comments
Assignees
Labels
kind/spike Investigation to provide direction and workable tasks os/windows priority/minor size/S
Projects

Comments

@gbraad
Copy link
Contributor

gbraad commented Jul 30, 2021

Investigate how the HTTP API can be used with a nodejs or electron application

@gbraad gbraad added kind/bug Something isn't working status/need triage labels Jul 30, 2021
@gbraad
Copy link
Contributor Author

gbraad commented Jul 30, 2021

Using named pipes with the request-library always returns 40 Bad request.

With the got-library as follows it works:

const got = require('got');
const options = {
  url: `http://unix://?/pipe/crc-http:/api/status`,
  method: 'GET'
};
function callback(error, response, body) {
  if (!error && response.statusCode == 200) {
    const status = JSON.parse(body);
    console.log(status)
  }
  else {
    console.log(response.statusCode)
    console.log(error)
  }
}
got(options, callback);

node-fetch-library returns 404 Not Found for all calls using a named pipe.

electron-fetch also does not work as expected.

@gbraad gbraad added kind/spike Investigation to provide direction and workable tasks os/windows priority/minor size/S and removed kind/bug Something isn't working status/need triage labels Jul 30, 2021
@gbraad gbraad self-assigned this Jul 30, 2021
@gbraad
Copy link
Contributor Author

gbraad commented Jul 30, 2021

Concluded; when named pipes are used in combination with HTTP and Electron, it would be suggested to use got.

@gbraad
Copy link
Contributor Author

gbraad commented Jul 30, 2021

From the got-library README


Electron support has been removed
The Electron net module is not consistent with the Node.js http module. See #899 for more info.


Which means the useElectronNet: true option is not available anymore. It therefore relies on the nodejs http module.

@gbraad
Copy link
Contributor Author

gbraad commented Aug 2, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/spike Investigation to provide direction and workable tasks os/windows priority/minor size/S
Projects
No open projects
Sprint 205
  
Done
Development

No branches or pull requests

1 participant