Posts

Showing posts from August, 2020

Api testing using GOT

  We all know that request library has been deprecated , so I was searching for a new and better API library , as part of that I found GOT Please refer to below link for the cool features of GOT https://www.npmjs.com/package/got#comparison Installation of GOT package: use: npm install got Sample Program for get call  in TypeScript: import got from 'got' ; export class A { static async f1 () { const burl = 'https://xyzabctest.com' ;     //Way 1 const res1 = Promise . resolve ( got . get ( burl ));     //Way 2 const res2 = await got . get ( burl );     //Way 3 const res4 = await got ( burl ); await console . log ( "t1------------------------------>" + res1 . then ((t)=>{ console . log (t. body )})); await console . log ( "t4------------------------------>" + res2 . body ) await console . log ( "t5------------------------------>" + res4 . body ) const res5 = res1 . then ((t)=>{ return t...