Socket
Socket
Sign inDemoInstall

get-it

Package Overview
Dependencies
Maintainers
1
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-it - npm Package Compare versions

Comparing version 0.0.12 to 1.0.0

2

lib/request/node-request.js

@@ -44,3 +44,3 @@ 'use strict';

lengthHeader['Content-Length'] = options.bodySize;
} else if (options.body && bodyType !== 'stream') {
} else if (options.body && Buffer.isBuffer(options.body)) {
lengthHeader['Content-Length'] = options.body.length;

@@ -47,0 +47,0 @@ }

{
"name": "get-it",
"version": "0.0.12",
"version": "1.0.0",
"description": "Generic HTTP request library for node and browsers",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -118,3 +118,3 @@ # get-it

With the Promise API, you can cancel requests using a _cancel token_. This API is based on the [Cancelable Promises proposal](https://github.com/tc39/proposal-cancelable-promises), which is currently at Stage 1.
With the Promise API, you can cancel requests using a _cancel token_. This API is based on the [Cancelable Promises proposal](https://github.com/tc39/proposal-cancelable-promises), which was at Stage 1 before it was withdrawn.

@@ -121,0 +121,0 @@ You can create a cancel token using the `CancelToken.source` factory as shown below:

@@ -7,3 +7,2 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.getIt = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

"use strict";var objectAssign=require("object-assign"),leadingSlash=/^\//,trailingSlash=/\/$/;module.exports=function(r){var e=r.replace(trailingSlash,"");return{processOptions:function(r){if(/^https?:\/\//i.test(r.url))return r;var s=[e,r.url.replace(leadingSlash,"")].join("/");return objectAssign({},r,{url:s})}}};
},{"object-assign":34}],4:[function(require,module,exports){

@@ -20,2 +19,3 @@ "use strict";function Cancel(e){this.message=e}Cancel.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Cancel.prototype.__CANCEL__=!0,module.exports=Cancel;

"use strict";function stringifyBody(e){var t=(e.headers["content-type"]||"").toLowerCase(),s=t.indexOf("application/json")!==-1;return s?tryFormat(e.body):e.body}function tryFormat(e){try{var t="string"==typeof e?JSON.parse(e):e;return JSON.stringify(t,null,2)}catch(t){return e}}var debugIt=require("debug");module.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.verbose,s=e.namespace||"get-it",r=debugIt(s),n=e.log||r,o=n===r&&!debugIt.enabled(s),u=0;return{processOptions:function(e){return e.requestId=e.requestId||++u,e},onRequest:function(e){if(o||!e)return e;var s=e.options;return n("[%s] HTTP %s %s",s.requestId,s.method,s.url),t&&s.body&&"string"==typeof s.body&&n("[%s] Request body: %s",s.requestId,s.body),t&&s.headers&&n("[%s] Request headers: %s",s.requestId,JSON.stringify(s.headers,null,2)),e},onResponse:function(e,s){if(o||!e)return e;var r=s.options.requestId;return n("[%s] Response code: %s %s",r,e.statusCode,e.statusMessage),t&&e.body&&n("[%s] Response body: %s",r,stringifyBody(e)),e},onError:function(e,t){return n("[%s] ERROR: %s",t.options.requestId,e.message),e}}};
},{"debug":26}],8:[function(require,module,exports){

@@ -32,2 +32,3 @@ "use strict";function normalizeTimeout(e){if(e===!1||0===e)return!1;if(e.connect||e.socket)return e;var t=Number(e);return isNaN(t)?normalizeTimeout(defaultOptions.timeout):{connect:t,socket:t}}function removeUndefined(e){var t={};for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}var objectAssign=require("object-assign"),urlParse=require("url-parse"),defaultOptions={timeout:12e4};module.exports=function(e){var t="string"==typeof e?objectAssign({url:e},defaultOptions):objectAssign({},defaultOptions,e),r=urlParse(t.url,{},!0);return t.timeout=normalizeTimeout(t.timeout),t.query&&(r.query=objectAssign({},r.query,removeUndefined(t.query))),t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t.url=r.toString(),t};

"use strict";exports.base=require("./base"),exports.debug=require("./debug"),exports.jsonRequest=require("./jsonRequest"),exports.jsonResponse=require("./jsonResponse"),exports.httpErrors=require("./httpErrors"),exports.retry=require("./retry"),exports.promise=require("./promise"),exports.observable=require("./observable"),exports.progress=require("./progress"),exports.headers=require("./headers");
},{"./base":3,"./debug":7,"./headers":9,"./httpErrors":10,"./jsonRequest":12,"./jsonResponse":13,"./observable":14,"./progress":16,"./promise":17,"./retry":18}],12:[function(require,module,exports){

@@ -81,3 +82,2 @@ "use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},objectAssign=require("object-assign"),isPlainObject=require("is-plain-object"),serializeTypes=["boolean","string","number"];module.exports=function(){return{processOptions:function(e){var o=e.body,t=serializeTypes.indexOf("undefined"==typeof o?"undefined":_typeof(o))!==-1||Array.isArray(o)||isPlainObject(o)||o&&"function"==typeof o.toJSON;return t?objectAssign({},e,{body:JSON.stringify(e.body),headers:objectAssign({},e.headers,{"Content-Type":"application/json"})}):e}}};

function forEach(r,t,o){if(!isFunction(t))throw new TypeError("iterator must be a function");arguments.length<3&&(o=this),"[object Array]"===toString.call(r)?forEachArray(r,t,o):"string"==typeof r?forEachString(r,t,o):forEachObject(r,t,o)}function forEachArray(r,t,o){for(var n=0,a=r.length;n<a;n++)hasOwnProperty.call(r,n)&&t.call(o,r[n],n,r)}function forEachString(r,t,o){for(var n=0,a=r.length;n<a;n++)t.call(o,r.charAt(n),n,r)}function forEachObject(r,t,o){for(var n in r)hasOwnProperty.call(r,n)&&t.call(o,r[n],n,r)}var isFunction=require("is-function");module.exports=forEach;var toString=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty;
},{"is-function":29}],29:[function(require,module,exports){

@@ -102,5 +102,5 @@ function isFunction(o){var t=toString.call(o);return"[object Function]"===t||"function"==typeof o&&"[object RegExp]"!==t||"undefined"!=typeof window&&(o===window.setTimeout||o===window.alert||o===window.confirm||o===window.prompt)}module.exports=isFunction;var toString=Object.prototype.toString;

var trim=require("trim"),forEach=require("for-each"),isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)};module.exports=function(r){if(!r)return{};var e={};return forEach(trim(r).split("\n"),function(r){var t=r.indexOf(":"),i=trim(r.slice(0,t)).toLowerCase(),o=trim(r.slice(t+1));"undefined"==typeof e[i]?e[i]=o:isArray(e[i])?e[i].push(o):e[i]=[e[i],o]}),e};
},{"for-each":28,"trim":41}],36:[function(require,module,exports){
function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function Item(e,t){this.fun=e,this.array=t}function noop(){}var process=module.exports={},cachedSetTimeout,cachedClearTimeout;!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var queue=[],draining=!1,currentQueue,queueIndex=-1;process.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var u=1;u<arguments.length;u++)t[u-1]=arguments[u];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};
},{}],37:[function(require,module,exports){

@@ -111,5 +111,5 @@ "use strict";function querystring(e){for(var r,n=/([^=?&]+)=?([^&]*)/g,t={};r=n.exec(e);t[decodeURIComponent(r[1])]=decodeURIComponent(r[2]));return t}function querystringify(e,r){r=r||"";var n=[];"string"!=typeof r&&(r="?");for(var t in e)has.call(e,t)&&n.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));return n.length?r+n.join("&"):""}var has=Object.prototype.hasOwnProperty;exports.stringify=querystringify,exports.parse=querystring;

"use strict";module.exports=function(e,t){if(t=t.split(":")[0],e=+e,!e)return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e};
},{}],39:[function(require,module,exports){
"use strict";var url=require("url");module.exports=function(o,r,t){if(o===r)return!0;var p=url.parse(o,!1,!0),e=url.parse(r,!1,!0),s=0|p.port||("https"===p.protocol?443:80),u=0|e.port||("https"===e.protocol?443:80),l={proto:p.protocol===e.protocol,hostname:p.hostname===e.hostname,port:s===u};return l.proto&&l.hostname&&(l.port||t)};
},{"url":40}],40:[function(require,module,exports){

@@ -119,2 +119,3 @@ "use strict";var regex=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;module.exports={regex:regex,parse:function(e){var o=regex.exec(e);return o?{protocol:(o[1]||"").toLowerCase()||void 0,hostname:(o[5]||"").toLowerCase()||void 0,port:o[6]||void 0}:{}}};

function trim(r){return r.replace(/^\s*|\s*$/g,"")}exports=module.exports=trim,exports.left=function(r){return r.replace(/^\s*/,"")},exports.right=function(r){return r.replace(/\s*$/,"")};
},{}],42:[function(require,module,exports){

@@ -121,0 +122,0 @@ "use strict";function extractProtocol(o){var t=protocolre.exec(o);return{protocol:t[1]?t[1].toLowerCase():"",slashes:!!t[2],rest:t[3]}}function resolve(o,t){for(var e=(t||"/").split("/").slice(0,-1).concat(o.split("/")),r=e.length,s=e[r-1],a=!1,l=0;r--;)"."===e[r]?e.splice(r,1):".."===e[r]?(e.splice(r,1),l++):l&&(0===r&&(a=!0),e.splice(r,1),l--);return a&&e.unshift(""),"."!==s&&".."!==s||e.push(""),e.join("/")}function URL(o,t,e){if(!(this instanceof URL))return new URL(o,t,e);var r,s,a,l,n,c,h=rules.slice(),i=typeof t,p=this,u=0;for("object"!==i&&"string"!==i&&(e=t,t=null),e&&"function"!=typeof e&&(e=qs.parse),t=lolcation(t),s=extractProtocol(o||""),r=!s.protocol&&!s.slashes,p.slashes=s.slashes||r&&t.slashes,p.protocol=s.protocol||t.protocol||"",o=s.rest,s.slashes||(h[2]=[/(.*)/,"pathname"]);u<h.length;u++)l=h[u],a=l[0],c=l[1],a!==a?p[c]=o:"string"==typeof a?~(n=o.indexOf(a))&&("number"==typeof l[2]?(p[c]=o.slice(0,n),o=o.slice(n+l[2])):(p[c]=o.slice(n),o=o.slice(0,n))):(n=a.exec(o))&&(p[c]=n[1],o=o.slice(0,n.index)),p[c]=p[c]||(r&&l[3]?t[c]||"":""),l[4]&&(p[c]=p[c].toLowerCase());e&&(p.query=e(p.query)),r&&t.slashes&&"/"!==p.pathname.charAt(0)&&(""!==p.pathname||""!==t.pathname)&&(p.pathname=resolve(p.pathname,t.pathname)),required(p.port,p.protocol)||(p.host=p.hostname,p.port=""),p.username=p.password="",p.auth&&(l=p.auth.split(":"),p.username=l[0]||"",p.password=l[1]||""),p.origin=p.protocol&&p.host&&"file:"!==p.protocol?p.protocol+"//"+p.host:"null",p.href=p.toString()}var required=require("requires-port"),lolcation=require("./lolcation"),qs=require("querystringify"),protocolre=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,rules=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]];URL.prototype.set=function(o,t,e){var r=this;switch(o){case"query":"string"==typeof t&&t.length&&(t=(e||qs.parse)(t)),r[o]=t;break;case"port":r[o]=t,required(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[o]="");break;case"hostname":r[o]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[o]=t,/:\d+$/.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!e;break;case"pathname":r.pathname=t.length&&"/"!==t.charAt(0)?"/"+t:t;break;default:r[o]=t}for(var s=0;s<rules.length;s++){var a=rules[s];a[4]&&(r[a[1]]=r[a[1]].toLowerCase())}return r.origin=r.protocol&&r.host&&"file:"!==r.protocol?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},URL.prototype.toString=function(o){o&&"function"==typeof o||(o=qs.stringify);var t,e=this,r=e.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var s=r+(e.slashes?"//":"");return e.username&&(s+=e.username,e.password&&(s+=":"+e.password),s+="@"),s+=e.host+e.pathname,t="object"==typeof e.query?o(e.query):e.query,t&&(s+="?"!==t.charAt(0)?"?"+t:t),e.hash&&(s+=e.hash),s},URL.extractProtocol=extractProtocol,URL.location=lolcation,URL.qs=qs,module.exports=URL;

@@ -21,6 +21,4 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.getIt = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

"use strict";function toObject(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function shouldUseNative(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;var n=Object.getOwnPropertyNames(r).map(function(e){return r[e]});if("0123456789"!==n.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}var hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;module.exports=shouldUseNative()?Object.assign:function(e,r){for(var t,n,o=toObject(e),a=1;a<arguments.length;a++){t=Object(arguments[a]);for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);if(Object.getOwnPropertySymbols){n=Object.getOwnPropertySymbols(t);for(var s=0;s<n.length;s++)propIsEnumerable.call(t,n[s])&&(o[n[s]]=t[n[s]])}}return o};
},{}],10:[function(require,module,exports){
var trim=require("trim"),forEach=require("for-each"),isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)};module.exports=function(r){if(!r)return{};var e={};return forEach(trim(r).split("\n"),function(r){var t=r.indexOf(":"),i=trim(r.slice(0,t)).toLowerCase(),o=trim(r.slice(t+1));"undefined"==typeof e[i]?e[i]=o:isArray(e[i])?e[i].push(o):e[i]=[e[i],o]}),e};
},{"for-each":6,"trim":15}],11:[function(require,module,exports){

@@ -27,0 +25,0 @@ "use strict";function querystring(e){for(var r,n=/([^=?&]+)=?([^&]*)/g,t={};r=n.exec(e);t[decodeURIComponent(r[1])]=decodeURIComponent(r[2]));return t}function querystringify(e,r){r=r||"";var n=[];"string"!=typeof r&&(r="?");for(var t in e)has.call(e,t)&&n.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));return n.length?r+n.join("&"):""}var has=Object.prototype.hasOwnProperty;exports.stringify=querystringify,exports.parse=querystring;

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