Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
An Advanced Network Request Package That Returns Body (Parsed As JSON If Needed), Headers And Status After Gzip Decompression.
aqt
is a network request package for Node.js that returns the body (parsed if returned as JSON), headers and status after gzip decompression when necessary.
yarn add -E @rqt/aqt
The package exports the main default asynchronous function to make requests.
import aqt from '@rqt/aqt'
aqt(
url: string,
options?: AqtOptions,
): AqtReturn
Makes a request to the URL, either with or without options.
import('http').OutgoingHttpHeaders
OutgoingHttpHeaders
AqtOptions
: Configuration for requests.
Name | Type | Description | Default |
---|---|---|---|
data* | Object | Optional data to send to the server with the request. | - |
type | 'form'|'json' | How to send data: json to serialise JSON data and form for url-encoded transmission with json mode by default. | 'json' |
headers | OutgoingHttpHeaders | Headers to use for the request. | - |
compress | boolean | Add the Accept-Encoding: gzip, deflate header to indicate to the server that it can send a compressed response. | true |
timeout | number | The timeout after which the request should fail. | - |
method | string | What HTTP method to use to send data. | POST |
binary | boolean | Whether to return a buffer instead of a string. | false |
justHeaders | boolean | Whether to stop the request after response headers were received, without waiting for the data. | false |
import aqt from '@rqt/aqt'
const Request = async (url) => {
const res = await aqt(url)
const resp = JSON.stringify(res, null, 2)
console.log(resp)
}
{
"body": "Hello World",
"headers": {
"content-type": "text/plain",
"date": "Sat, 02 Feb 2019 15:40:28 GMT",
"connection": "close",
"transfer-encoding": "chunked"
},
"statusCode": 200,
"statusMessage": "OK"
}
AqtReturn
TypeThe result of the aqt
function will have the following structure:
Property | Type | Description | Example |
---|---|---|---|
body | string|object|Buffer | The return from the server. In case json content-type was set by the server, the response will be parsed into an object. If binary option was used for the request, a Buffer will be returned. Otherwise, a string response is returned. | |
headers | object | Incoming headers returned by the server. | |
| |||
statusCode | number | The status code returned by the server. | 200 |
statusMessage | string | The status message set by the server. | OK |
© Art Deco for Rqt 2019 | Tech Nation Visa Sucks |
---|
1.2.2
JSON
if body is empty.FAQs
An Advanced Network Request Package That Returns Body (Parsed As JSON If Needed), Headers And Status After Gzip Decompression.
The npm package @rqt/aqt receives a total of 0 weekly downloads. As such, @rqt/aqt popularity was classified as not popular.
We found that @rqt/aqt 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.