
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
HTTP Promise based client
npm install next-req
import nextreq from 'next-req'
nextreq.get('www.yourapi.com').then(response => {
const payload = response.payload
// TODO - payload
}).catch(error => {
// TODO - error
}).finally(() => {
// will always run
})
Generating GET request with PARAMS
import nextreq from 'next-req'
nextreq.get('www.yourapi.com/user?session=true').then(response => {
const payload = response.payload
// TODO - payload
}).catch(error => {
// TODO - error
}).finally(() => {
// will always run
})
Generating GET request with params of config
import nextreq from 'next-req'
nextreq.get('www.yourapi.com/user', {
params: {
session: true
}
}).then(response => {
const payload = response.payload
// TODO - payload
}).catch(error => {
// TODO - error
}).finally(() => {
// will always run
})
Generating POST request
import nextreq from 'next-req'
nextreq.post('www.yourapi.com/user', {
params: {
setSession: true
}
}).then(response => {
const payload = response.payload
// TODO - payload
}).catch(error => {
// TODO - error
}).finally(() => {
// will always run
})
Generating API request using async/await on function using GET
import nextreq from 'next-req'
const getPayload = async () => {
try {
const request = await nextreq.get('www.yourapi.com/user?session=true')
const payload = request.payload
// TODO - with payload
} catch (error) {
// TODO - errors
} finally {
// will always run
}
}
Generating API request using async/await on function using POST
import nextreq from 'next-req'
const postPayload = async () => {
try {
const request = await nextreq.post('www.yourapi.com/user', {
params: {
setSession: true
}
})
const payload = request.payload
// TODO - with payload
} catch (error) {
// TODO - errors
} finally {
// will always run
}
}
Generating interceptors
import nextreq from 'next-req'
// Add request interceptor
nextreq.interceptors.request.use(configs => {
// TODO - with configs
return configs
})
// Add response interceptor
nextreq.interceptors.response.use(
response => {
// TODO - with response
return response
},
error => {
// TODO - errors
// Handle error
return Promise.reject(error)
}
)
import nextreq from 'next-req'
nextreq.post('www.yourapi.com/user', {
params: {
setSession: false
}
}).then(response => {
// TODO - with response
}).catch (error => {
// Evaluate error response to proceed
if (error.response) {
// Get error payload
const payload = error.response.payload
// Get error status
const status = error.response.status
// Get headers
const headers = error.response.headers
// TODO - errors
} else {
// An error occured in request
// Get message
const message = error.message
}
// Get configs
const configs = error.config
})
👤 Prince Khanyile
MIT
FAQs
HTTP Promise based client
We found that next-req 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.