Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
@svkhrobbeck/fetcher
Advanced tools
Fetcher — bu Axiosdan ilhomlangan to'liq xususiyatli HTTP kutubxonasi bo'lib, zamonaviy JavaScript muhitlarida HTTP so'rovlarini amalga oshirishni soddalashtiradi. Fetcher sizga qulay interfeys, so'rovlarni bekor qilish, interceptorlar, xatoliklarni boshq
Fetcher — bu Axiosdan ilhomlangan to'liq xususiyatli HTTP kutubxonasi bo'lib, zamonaviy JavaScript muhitlarida HTTP so'rovlarini amalga oshirishni soddalashtiradi. Fetcher sizga qulay interfeys, so'rovlarni bekor qilish, interceptorlar, xatoliklarni boshqarish va boshqa ko'plab imkoniyatlarni taqdim etadi.
transformData
funksiyasidan foydalaning.fetch
va xhr
).await
) va Promise
asosida ishlash.Fetcher kutubxonasini NPM orqali o'rnating:
npm install @svkhrobbeck/fetcher
Yoki Yarn orqali:
yarn add @svkhrobbeck/fetcher
import fetcher from "@svkhrobbeck/fetcher";
fetcher
.get("https://api.example.com/data")
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error("Error fetching data:", error);
});
fetcher
.post("https://api.example.com/users", {
name: "Ichigo Kurosaki",
email: "ichigo.kurosaki@example.com"
})
.then(response => {
console.log("User created:", response.data);
})
.catch(error => {
console.error("Error creating user:", error);
});
const { token, cancel } = fetcher.CancelToken.source();
fetcher
.get("https://api.example.com/data", {
cancelToken: token
})
.catch(error => {
if (fetcher.isCancel(error)) {
console.log("Request canceled:", error.message);
} else {
console.error("Error:", error);
}
});
// So'rovni istalgan vaqtda bekor qilish
cancel("Operation canceled by the user.");
// So'rov Interceptori
fetcher.interceptors.request.use(
config => {
console.log("Request started:", config);
return config;
},
error => {
return Promise.reject(error);
}
);
// Javob Interceptori
fetcher.interceptors.response.use(
response => {
console.log("Response received:", response);
return response;
},
error => {
return Promise.reject(error);
}
);
Fetcher bilan moslashtirilgan instansiyani yaratish va undan foydalanish:
const customFetcher = fetcher.create({
baseURL: "https://api.example.com",
headers: {
Authorization: "Bearer YOUR_ACCESS_TOKEN"
}
});
customFetcher
.get("/protected-data")
.then(response => console.log(response.data))
.catch(error => console.error("Error fetching protected data:", error));
await
va Promise
yordamida ishlashni soddalashtiradi.FAQs
Fetcher — bu Axiosdan ilhomlangan to'liq xususiyatli HTTP kutubxonasi bo'lib, zamonaviy JavaScript muhitlarida HTTP so'rovlarini amalga oshirishni soddalashtiradi. Fetcher sizga qulay interfeys, so'rovlarni bekor qilish, interceptorlar, xatoliklarni boshq
We found that @svkhrobbeck/fetcher 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.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
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.