Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rqt/aqt

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rqt/aqt - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

47

build/index.js

@@ -14,12 +14,13 @@ const { request: https } = require('https');

* @param {string} address The URL such as http://example.com/api.
* @param {Config} [config] Configuration for requests.
* @param {Object} config.data Optional data to send to the server with the request.
* @param {'form'|'json'} [config.type="'json'"] How to send data: `json` to serialise JSON data and `form` for url-encoded transmission with `json` mode by default. Default `'json'`.
* @param {OutgoingHttpHeaders} [config.headers] Headers to use for the request.
* @param {boolean} [config.compress=true] Add the `Accept-Encoding: gzip, deflate` header automatically to indicate to the server that it can send a compressed response. Default `true`.
* @param {string} [config.headers="POST"] What HTTP method to use to send data. Default `POST`.
* @param {boolean} [config.binary=false] Whether to return a buffer instead of a string. Default `false`.
* @param {boolean} [config.justHeaders=false] Whether to stop the request after response headers were received, without waiting for the data. Default `false`.
* @param {AqtOptions} [options] Configuration for requests.
* @param {Object} options.data Optional data to send to the server with the request.
* @param {'form'|'json'} [options.type="'json'"] How to send data: `json` to serialise JSON data and `form` for url-encoded transmission with `json` mode by default. Default `'json'`.
* @param {OutgoingHttpHeaders} [options.headers] Headers to use for the request.
* @param {boolean} [options.compress=true] Add the `Accept-Encoding: gzip, deflate` header automatically to indicate to the server that it can send a compressed response. Default `true`.
* @param {string} [options.headers="POST"] What HTTP method to use to send data. Default `POST`.
* @param {boolean} [options.binary=false] Whether to return a buffer instead of a string. Default `false`.
* @param {boolean} [options.justHeaders=false] Whether to stop the request after response headers were received, without waiting for the data. Default `false`.
* @returns {Promise.<AqtReturn>} The body, headers and status.
*/
const aqt = async (address, config = {}) => {
const aqt = async (address, options = {}) => {
const {

@@ -35,3 +36,3 @@ data: d,

justHeaders = false,
} = config
} = options
const er = erotic(true)

@@ -43,3 +44,3 @@

const options = {
const opts = {
hostname,

@@ -59,8 +60,8 @@ port,

options.method = method
options.headers['Content-Type'] = contentType
options.headers['Content-Length'] = Buffer.byteLength(data)
opts.method = method
opts.headers['Content-Type'] = contentType
opts.headers['Content-Length'] = Buffer.byteLength(data)
}
if (compress) {
options.headers['Accept-Encoding'] = 'gzip, deflate'
opts.headers['Accept-Encoding'] = 'gzip, deflate'
}

@@ -71,3 +72,3 @@

parsedBody,
} = await exec(request, options, {
} = await exec(request, opts, {
data,

@@ -95,3 +96,3 @@ justHeaders,

*
* @typedef {Object} Config Configuration for requests.
* @typedef {Object} AqtOptions Configuration for requests.
* @prop {Object} data Optional data to send to the server with the request.

@@ -106,2 +107,14 @@ * @prop {'form'|'json'} [type="'json'"] How to send data: `json` to serialise JSON data and `form` for url-encoded transmission with `json` mode by default. Default `'json'`.

/* documentary types/return.xml */
/**
* @typedef {import('http').IncomingHttpHeaders} IncomingHttpHeaders
*
* @typedef {Object} AqtReturn
* @prop {string|object|Buffer} body The return from the server. In case the `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.
* @prop {IncomingHttpHeaders} headers Incoming headers returned by the server.
* @prop {number} statusCode The status code returned by the server.
* @prop {string} statusMessage The status message set by the server.
*/
//# sourceMappingURL=index.js.map
## 26 September 2018
### 1.1.2
- [types] Add return type to the build.
### 1.1.1

@@ -4,0 +8,0 @@

{
"name": "@rqt/aqt",
"version": "1.1.1",
"version": "1.1.2",
"description": "An Advanced Network Request Package That Returns Body (Parsed As JSON If Needed), Headers And Status After Gzip Decompression.",

@@ -5,0 +5,0 @@ "main": "build",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc