Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@dnpr/make-request
Advanced tools
A simple HTTP / HTTPS agent for Node.js.
npm install @dnpr/make-request
import { makeRequest } from "@dnpr/make-request"
const httpTarget = "http://httpbin.org"
const httpsTarget = "https://httpbin.org"
const USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
async function main() {
const headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "en-US,en;q=0.9",
"user-agent": USER_AGENT
}
const testBody = {
message: "hello world"
}
try {
/** A GET request with HTTP. */
const testHttp = makeRequest("GET", httpTarget + "/get")()
console.log((await testHttp).data.toString())
/** A GET request with HTTPS. */
const testHttps = makeRequest("GET", httpsTarget + "/get")()
console.log((await testHttps).data.toString())
/** A GET request with HTTPS and headers. */
const testHttpsHeader =
makeRequest("GET", httpsTarget + "/get")
.useHeaders(headers)()
console.log((await testHttpsHeader).data.toString())
/** A POST request with JSON. */
const testJson =
makeRequest("POST", "https://reqbin.com/echo/post/json")
.useSerializer(JSON.stringify)
.useDeserializer(JSON.parse)({
login: "login", password: "password"
})
console.log((await testJson).data)
/** A bad POST request with incorrectly serialized body. */
const testBadJson =
makeRequest("POST", "https://reqbin.com/echo/post/json")(testBody)
console.log((await testBadJson).data)
} catch (error) {
console.error(error)
}
}
main()
git clone https://github.com/dnpr/make-request.git
yarn install
npm test
FAQs
A simple HTTP/HTTPS agent for Node.js.
The npm package @dnpr/make-request receives a total of 300 weekly downloads. As such, @dnpr/make-request popularity was classified as not popular.
We found that @dnpr/make-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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
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.