Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@gitbeaker/requester-utils
Advanced tools
Utility functions for requester implementatons used in @gitbeaker
@gitbeaker/requester-utils is a utility package designed to facilitate HTTP requests, particularly in the context of interacting with GitLab's API. It provides a set of tools to simplify the process of making authenticated requests, handling responses, and managing configurations.
Authenticated Requests
This feature allows you to create a requester function that automatically includes authentication headers in your HTTP requests. The code sample demonstrates how to create a requester and make a GET request to fetch projects.
const { createRequesterFn } = require('@gitbeaker/requester-utils');
const requester = createRequesterFn({
host: 'https://gitlab.example.com',
token: 'your_access_token',
});
requester.get('/projects')
.then(response => console.log(response))
.catch(error => console.error(error));
Custom Request Configurations
This feature allows you to customize various request configurations such as timeout settings. The code sample shows how to set a custom request timeout.
const { createRequesterFn } = require('@gitbeaker/requester-utils');
const requester = createRequesterFn({
host: 'https://gitlab.example.com',
token: 'your_access_token',
requestTimeout: 5000,
});
requester.get('/projects')
.then(response => console.log(response))
.catch(error => console.error(error));
Handling Responses
This feature provides a way to handle responses and errors effectively. The code sample demonstrates how to check the response status and handle errors.
const { createRequesterFn } = require('@gitbeaker/requester-utils');
const requester = createRequesterFn({
host: 'https://gitlab.example.com',
token: 'your_access_token',
});
requester.get('/projects')
.then(response => {
if (response.status === 200) {
console.log('Projects:', response.data);
} else {
console.error('Error:', response.statusText);
}
})
.catch(error => console.error('Request failed:', error));
Axios is a popular promise-based HTTP client for the browser and Node.js. It provides similar functionalities such as making HTTP requests, handling responses, and managing configurations. Compared to @gitbeaker/requester-utils, Axios is more general-purpose and widely used across various projects.
Node-fetch is a lightweight module that brings `window.fetch` to Node.js. It is used for making HTTP requests and handling responses. While it offers similar functionalities, it is more minimalistic compared to @gitbeaker/requester-utils, which is tailored for GitLab API interactions.
Request is a simplified HTTP client for Node.js with a user-friendly API. It provides functionalities for making HTTP requests and handling responses. Although it is similar in purpose, it is more feature-rich and flexible compared to @gitbeaker/requester-utils.
Utility for creating custom wrappers around the @gitbeaker/core GitLab SDK.
Browsers |
Load @gitbeaker/requester-utils directly from esm.sh
|
---|---|
Deno |
Load @gitbeaker/requester-utils directly from esm.sh
|
Node 18+ |
Install with
|
This started as a fork from node-gitlab-legacy but I ended up rewriting much of the code. Here are the original work's contributors.
FAQs
Utility functions for requester implementatons used in @gitbeaker
The npm package @gitbeaker/requester-utils receives a total of 541,652 weekly downloads. As such, @gitbeaker/requester-utils popularity was classified as popular.
We found that @gitbeaker/requester-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.