Socket
Socket
Sign inDemoInstall

httpie

Package Overview
Dependencies
0
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-next.10 to 2.0.0-next.11

8

fetch/index.js

@@ -9,3 +9,3 @@ function apply(src, tar) {

opts = opts || {};
var timer, tmp, ctrl;
var timer, ctrl, tmp=opts.body;

@@ -15,5 +15,7 @@ opts.method = method;

if (opts.body && typeof opts.body == 'object') {
if (tmp instanceof FormData) {
// leave it
} else if (tmp && typeof tmp == 'object') {
opts.headers['content-type'] = 'application/json';
opts.body = JSON.stringify(opts.body);
opts.body = JSON.stringify(tmp);
}

@@ -20,0 +22,0 @@

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.httpie={})}(this,(function(e){function t(e,t){t.statusMessage=e.statusText,t.statusCode=e.status,t.data=e.body}function n(e,n,o){var i,a,s;return(o=o||{}).method=e,o.headers=o.headers||{},o.body&&"object"==typeof o.body&&(o.headers["content-type"]="application/json",o.body=JSON.stringify(o.body)),o.withCredentials&&(o.credentials="include"),o.timeout&&(s=new AbortController,o.signal=s.signal,i=setTimeout(s.abort,o.timeout)),new Promise((e,d)=>{fetch(n,o).then((n,s)=>{clearTimeout(i),t(n,n),s=n.status>=400?d:e,(a=n.headers.get("content-type"))&&~a.indexOf("application/json")?n.text().then(e=>{try{n.data=JSON.parse(e,o.reviver),s(n)}catch(e){e.headers=n.headers,t(n,e),d(e)}}):s(n)}).catch(e=>{e.timeout=s&&s.signal.aborted,d(e)})})}var o=n.bind(n,"GET"),i=n.bind(n,"POST"),a=n.bind(n,"PATCH"),s=n.bind(n,"DELETE"),d=n.bind(n,"PUT");e.del=s,e.get=o,e.patch=a,e.post=i,e.put=d,e.send=n}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.httpie={})}(this,(function(t){function e(t,e){e.statusMessage=t.statusText,e.statusCode=t.status,e.data=t.body}function n(t,n,o){var a,i,s=(o=o||{}).body;return o.method=t,o.headers=o.headers||{},s instanceof FormData||s&&"object"==typeof s&&(o.headers["content-type"]="application/json",o.body=JSON.stringify(s)),o.withCredentials&&(o.credentials="include"),o.timeout&&(i=new AbortController,o.signal=i.signal,a=setTimeout(i.abort,o.timeout)),new Promise((t,d)=>{fetch(n,o).then((n,i)=>{clearTimeout(a),e(n,n),i=n.status>=400?d:t,(s=n.headers.get("content-type"))&&~s.indexOf("application/json")?n.text().then(t=>{try{n.data=JSON.parse(t,o.reviver),i(n)}catch(t){t.headers=n.headers,e(n,t),d(t)}}):i(n)}).catch(t=>{t.timeout=i&&i.signal.aborted,d(t)})})}var o=n.bind(n,"GET"),a=n.bind(n,"POST"),i=n.bind(n,"PATCH"),s=n.bind(n,"DELETE"),d=n.bind(n,"PUT");t.del=s,t.get=o,t.patch=i,t.post=a,t.put=d,t.send=n}));
{
"name": "httpie",
"version": "2.0.0-next.10",
"version": "2.0.0-next.11",
"repository": "lukeed/httpie",

@@ -35,3 +35,4 @@ "description": "A lightweight, Promise-based HTTP client for Node.js and the browser~!",

"require": "./xhr/index.js"
}
},
"./package.json": "./package.json"
},

@@ -38,0 +39,0 @@ "author": {

@@ -11,4 +11,4 @@ function apply(src, tar) {

opts = opts || {};
var k, str, tmp, arr;
var req = new XMLHttpRequest;
var k, tmp, arr, str=opts.body;
var headers = opts.headers || {};

@@ -47,3 +47,5 @@

if ((str = opts.body) && typeof str == 'object') {
if (typeof FormData < 'u' && str instanceof FormData) {
// str = opts.body
} else if (str && typeof str == 'object') {
headers['content-type'] = 'application/json';

@@ -50,0 +52,0 @@ str = JSON.stringify(str);

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.httpie={})}(this,(function(e){function t(e,t){t.headers=e.headers||{},t.statusMessage=e.statusText,t.statusCode=e.status,t.data=e.response}function n(e,n,o){return new Promise((function(i,s){var r,a,d,u;o=o||{};var p=new XMLHttpRequest,f=o.headers||{};for(r in o.timeout&&(p.timeout=o.timeout),p.ontimeout=p.onerror=function(e){e.timeout="timeout"==e.type,s(e)},p.open(e,n.href||n),p.onload=function(){for(u=p.getAllResponseHeaders().trim().split(/[\r\n]+/),t(p,p);d=u.shift();)d=d.split(": "),p.headers[d.shift().toLowerCase()]=d.join(": ");if((d=p.headers["content-type"])&&~d.indexOf("application/json"))try{p.data=JSON.parse(p.data,o.reviver)}catch(e){return t(p,e),s(e)}(p.status>=400?s:i)(p)},(a=o.body)&&"object"==typeof a&&(f["content-type"]="application/json",a=JSON.stringify(a)),p.withCredentials=!!o.withCredentials,f)p.setRequestHeader(r,f[r]);p.send(a)}))}var o=n.bind(n,"GET"),i=n.bind(n,"POST"),s=n.bind(n,"PATCH"),r=n.bind(n,"DELETE"),a=n.bind(n,"PUT");e.del=r,e.get=o,e.patch=s,e.post=i,e.put=a,e.send=n}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.httpie={})}(this,(function(t){function e(t,e){e.headers=t.headers||{},e.statusMessage=t.statusText,e.statusCode=t.status,e.data=t.response}function n(t,n,o){return new Promise((function(i,s){o=o||{};var a,r,d,u=new XMLHttpRequest,f=o.body,p=o.headers||{};for(a in o.timeout&&(u.timeout=o.timeout),u.ontimeout=u.onerror=function(t){t.timeout="timeout"==t.type,s(t)},u.open(t,n.href||n),u.onload=function(){for(d=u.getAllResponseHeaders().trim().split(/[\r\n]+/),e(u,u);r=d.shift();)r=r.split(": "),u.headers[r.shift().toLowerCase()]=r.join(": ");if((r=u.headers["content-type"])&&~r.indexOf("application/json"))try{u.data=JSON.parse(u.data,o.reviver)}catch(t){return e(u,t),s(t)}(u.status>=400?s:i)(u)},typeof FormData<"u"&&f instanceof FormData||f&&"object"==typeof f&&(p["content-type"]="application/json",f=JSON.stringify(f)),u.withCredentials=!!o.withCredentials,p)u.setRequestHeader(a,p[a]);u.send(f)}))}var o=n.bind(n,"GET"),i=n.bind(n,"POST"),s=n.bind(n,"PATCH"),a=n.bind(n,"DELETE"),r=n.bind(n,"PUT");t.del=a,t.get=o,t.patch=s,t.post=i,t.put=r,t.send=n}));

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc