Checking Webservice Reponse

Hi, I want to check the response of webservice in appium. I heard about httpclient. shall i use this lib for the same or any other lib is more suitable for the same???

you can use REST Assured library for that. Appium is only for UI level automation

I have created my appium automation framework using javascript + mocha so I use supertest.js (for http calls) with should.js (for assertions) to handle api calls.

A sample POST request looks like:

request

.post('/api/pet')

.send({ name: 'Manny', species: 'cat' })

.set('X-API-Key', 'foobar')

.set('Accept', 'application/json')

.end(function(err, res){

 if (err || !res.ok) {

   console.log('Oh no! error');

 } else {

   console.log(res.body)
  //You can add assertions like
   res.body.data.should.be.an.Object();
   res.body.data.name.should.be.a.String();

 }

});