import retry from "async-retry" ; import https from "https" ; export function postPayload ( endpoint , body ) { return ( retry ( ( ) => { return new Promise < void > ( ( resolve , reject ) => { const req = https . request ( endpoint , { method : "POST" , headers : { "content-type" : "application/json" } , timeout : 5000 , } , ( resp ) => { if ( resp . statusCode !== 200 ) { reject ( new Error ( `Unexpected status code: ${ resp . statusCode }` ) ) ; return ; } resolve ( ) ; } ) ; req . write ( JSON . stringify ( body ) ) ; req . end ( ) ; } ) ; } , { minTimeout : 500 , retries : 1 , factor : 1 } ) . catch ( ( ) => { } ) . then ( ( ) => { return ; } , ( ) => { return ; } ) ) ; }