import fetch , { Response } from 'node-fetch' ; import { URL } from 'url' ; export class HttpService { public async get ( url , authorization ) { return await fetch ( url , { method : 'get' , headers : { Authorization : authorization , Accept : 'application/json' , } , } ) ; } public async post ( url , authorization , body ? ) { return await fetch ( url , { method : 'post' , headers : { Authorization : authorization , 'Content-Type' : 'application/json' , Accept : 'application/json' , } , body : body ? JSON . stringify ( body ) : undefined , } ) ; } public async put ( url , authorization , body ? ) { return await fetch ( url , { method : 'put' , headers : { Authorization : authorization , 'Content-Type' : 'application/json' , Accept : 'application/json' , } , body : body ? JSON . stringify ( body ) : undefined , } ) ; } public async delete ( url , authorization , body ? ) { return await fetch ( url , { method : 'delete' , headers : { Authorization : authorization , 'Content-Type' : 'application/json' , Accept : 'application/json' , } , body : body ? JSON . stringify ( body ) : undefined , } ) ; } }