This commit is contained in:
Joel Male
2020-08-27 18:23:33 +10:00
parent 9fa1db0dd2
commit 01d242f5b1
109 changed files with 198798 additions and 322059 deletions
+2 -2
View File
@@ -1,14 +1,14 @@
const fetch = require('node-fetch');
class Http {
make(url: string, headers: string, body: string): Promise<any> {
make(url: string, headers: string|null, body: string|null): Promise<any> {
return new Promise((resolve, reject) => {
fetch(url, this.getOptions('post', headers, body))
.then((res: Response) => resolve(res));
});
}
getOptions(method: string, headers: string, body: string) {
getOptions(method: string, headers: string|null, body: string|null) {
const options: any = {
headers: headers ? JSON.parse(headers) : {},
method