Hi,

I have a requirement to call a RESTful webservice. The web service does not 
exist yet. so I tried to mimic the response from server.
What I am supposed to do is that, 

   1. if web service responds with response_status=200 then just render the 
   data
   2. if web service responds with response_status=201 and a url to a 
   different request; then call this new url with a http post

Web service will try to find the data in database. If data is found then 
response_status = 200 , else it will send client to a new url to add the 
data(since data is not in database)


I have pasted my code in this link below.

http://stackoverflow.com/questions/38249388/mock-a-http-request-to-respond-according-to-response-status-how-do-i-approach-t

my question is that am I on the right track. I was planning to create 
another service that basically calls this one so that I mimic the actual 
call to backend. I was thinking that after restful service is created I 
could add in all the required changes. 

I am using

   - karma-jasmine for writing my unit tests.
   - angular 1.5


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to