
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
zod-request
Advanced tools
Validated and Type-safe HTTP requests using Zod
fetch
with extra featuresnpm install zod-request zod
import { fetch } from 'zod-request';
import { z } from 'zod';
const todoSchema = z.object({
userId: z.number(),
id: z.number(),
title: z.string(),
completed: z.boolean()
});
const response = await fetch('https://jsonplaceholder.typicode.com/todos', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
schema: {
response: z.array(todoSchema)
}
});
// type of data is [{ userId: number, id: number, title: string, completed: boolean }, ...]
const data = await response.json();
console.log(Array.isArray(data)); // true
console.log(data.length); // 200
For all configuration options, please see the API docs.
You can contribute to this project by opening an issue or a pull request on GitHub. Feel free to contribute, we care about your ideas and suggestions.
import { fetch } from 'zod-request';
import { z } from 'zod';
const schema = {
body: z.object({
name: z.string(),
age: z.number()
}),
response: z.object({
form: z.record(z.any()),
headers: z.record(z.string())
})
};
const response = await fetch('https://httpbin.org/post', {
method: 'POST',
form: {
name: 'John',
age: 20
},
schema: schema
});
const { form, headers } = await response.json();
console.log(form); // { name: 'John', age: '20' }
console.log(headers); // { 'Content-Type': 'multipart/form-data; boundary=---- ...
const response = await fetch('https://jsonplaceholder.typicode.com/todos', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.unsafeJson(); // Throws an error if the response is not a valid JSON
console.log(Array.isArray(data)); // true
console.log(data.length); // 200
FAQs
Validated and Type-safe HTTP requests using Zod
The npm package zod-request receives a total of 2,308 weekly downloads. As such, zod-request popularity was classified as popular.
We found that zod-request demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.