mardi 21 avril 2015

Stub Mock API in angularJS

We are using stubbed server to mock API unit testing of AngularJs. Following is the code yaml file. When we are not posting data its working fine. buts as soon as we post data along it, we get 404 error for the API.

request:
        url: ^/api/test/query$
        method: POST     
        headers:
          Content-Type: application/json;charset=utf-8
        post: '[{"<postdata>"}]'
response:
        status: 200
        Content-Type: application/json
        file: <response_file_path>/account.json  

In the above yaml code if we remove the post section that is post: '[{}]' the mock API works fine. We are using gulp server and we have made the desired change in the prism file.

Aucun commentaire:

Enregistrer un commentaire