Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
seal-request-service
Advanced tools
Makes a request to a service, using consul for discovery and lookup
Makes a request to a service, using consul for discovery and lookup.
$ npm install seal-request-service
First you need to add a reference to seal-request-service within your application.
var requestService = require('seal-request-service');
Please note: A connection to consul must already exist before you can use the module.
To create a HTTP/HTTPS request to an instance of a service use:
requestService({ service: 'myService' }, (err, req) => {
if (!err) {
throw new Error('An error occurred while connecting to the service.');
}
req.on('connect', () => {
console.log('Connected to service!');
});
req.write('Hello service!');
req.end();
});
The first parameter is an options
object that can contain the following properties:
property | type | description |
---|---|---|
service | required string | Name of the service to access |
headers | optional object | Additional HTTP/HTTPS headers |
method | optional string | HTTP/HTTPS method, default POST |
path | optional string | URL-path to access, default / |
Here is an example of a more complete options
object:
var options = {
headers: {
'content-type': 'application/json'
},
method: 'POST',
path: '/job',
service: 'myService'
};
The callback
function given as the second parameter will be called when a connection to a instance of the service could be established. In this case, the err
parameter is null
and the req
parameter contains a http.ClientRequest object for further use. Otherwise, the err
parameter contains an Error
object with further details about the problem.
The protocol used for a connection depends on the target (the service resides in the local or a remote host) and the value of the environment variable TLS_UNPROTECTED. The TLS certificates provided by seal-tlscert
will be used for HTTPS connections. It is not possible to override the chosen protocol.
Used protocol:
TLS_UNPROTECTED | local service | remote service |
---|---|---|
'world' | HTTP | HTTP |
'loopback' | HTTP | HTTPS |
'none' | HTTPS | HTTPS |
To build this module use roboter.
$ bot
FAQs
Makes a request to a service, using consul for discovery and lookup
We found that seal-request-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.