Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@degjs/fetch-utils
Advanced tools
FetchUtils is a utility module that adds the following features to the Javascript Fetch API:
You can view a demo of fetchUtils here.
As of version 3.0.0, fetchUtils is on NPM and can be installed with
npm install @degjs/fetch-utils
FetchUtils is a singleton, so it does not need to be instantiated.
import fetchUtils from "@degjs/fetch-utils";
/* Success handler */
function onSuccess(data) {
console.log("SUCCESS: " + data);
}
/* Error handler */
function onError(error) {
console.log("ERROR: " + error);
}
/* Perform a GET request with a 30-second timeout and expect a JSON-encoded response */
let fetchParams = {
method: 'GET'
};
let options = {
timeout: 30000
};
fetchUtils.getJSON('/endpoint-url', fetchParams, options)
.then(onSuccess)
.catch(onError);
Returns: Promise
Perform a request to an endpoint that returns HTML-encoded data. Sets the Accept
option on request header to text/html
.
Returns: Promise
Perform a request to an endpoint that returns JSON-encoded data. Sets the Accept
option on request header to application/json
.
Returns: Promise
Perform a request to an endpoint that returns the full, unparsed endpoint response.
The parameters for the .getHTML()
, .getJSON()
and .fetch()
methods are outlined below:
Type: String
The URL of the endpoint. This parameter is required.
Type: Object
Request options that are passed through to the fetch()
method. These options correspond to those defined in the Fetch API. This parameter is optional.
Type: Object
Additional options that fall outside of the Fetch API. This parameter is optional.
Type: Number
The number of milliseconds that the request should wait before timing out. The default timeout value is 10,000 millseconds (10 seconds).
Define a callback function that will be executed on fetch success. This is not recommended in most scenarios (use .then()
and .catch()
from the returned promise instead), but may be useful in specific situations.
Override default plugin options, such as timeout
and cachebusting
. Must be called before any of the fetch methods above are called.
FetchUtils depends on the following browser APIs:
To support legacy browsers, you'll need to include polyfills for the above APIs.
FAQs
A utility library for using the Javascript Fetch API.
The npm package @degjs/fetch-utils receives a total of 1 weekly downloads. As such, @degjs/fetch-utils popularity was classified as not popular.
We found that @degjs/fetch-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.