Fix cmd and add json to http
This commit is contained in:
parent
ea37422ea0
commit
d90ed53f08
@ -17,6 +17,6 @@
|
||||
"parcel-bundler": "^1.12.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@szczepano/huh": "0.0.6"
|
||||
"@szczepano/huh": "0.0.7"
|
||||
}
|
||||
}
|
||||
|
7
huh.js
7
huh.js
@ -64,7 +64,10 @@ export const HTTP = (o) => {
|
||||
if (o.type) {
|
||||
req.setRequestHeader('Content-type', o.type);
|
||||
}
|
||||
|
||||
if(o.json) {
|
||||
req.setRequestHeader('Content-type', 'application/json');
|
||||
o.data = JSON.stringify(o.data);
|
||||
}
|
||||
console.log(o.url);
|
||||
req.send(o.data);
|
||||
return new Promise((success, failure) => {
|
||||
@ -124,7 +127,7 @@ class CmdWrapper {
|
||||
this.once = once;
|
||||
this.chain = chain;
|
||||
this.handler = (e) => {
|
||||
this.cmd();
|
||||
this.cmd(e);
|
||||
if(this.once) {
|
||||
delete _hlisteners[e.type];
|
||||
removeEventListener(e.type, this.handler);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@szczepano/huh",
|
||||
"version": "0.0.6",
|
||||
"version": "0.0.7",
|
||||
"description": "huh",
|
||||
"main": "huh.js",
|
||||
"license": "BSD-3-Clause",
|
||||
|
Loading…
Reference in New Issue
Block a user