mdasberg / ng-apimock

Node plugin that provides the ability to use scenario based api mocking: for local development for protractor testing
MIT License
99 stars 26 forks source link

How to get a text/plain response? #76

Closed saury closed 4 years ago

saury commented 5 years ago

Here is my json file:

// text.json
{
  "expression": "/api/text",
  "method": "GET",
  "name": "webUrl",
  "responses": {
    "defaultData": {
      "default": true,
      "status": 200,
      "headers": {
        "content-type": "text/plain; charset=utf-8"
      },
      "data": "https://github.com/"
    }
  }
}

It returns me data wrapped with " with my client. And how can I mock the plain text? Any one can help?

mdasberg commented 4 years ago

you can use a file for now.

{
   "file": "text.txt",
   "headers": {
       "Content-type": "text/plain; charset=utf-8",
       "custom": "custom",
       "filename": "text.txt"
   }
}

I will have to check why it wraps it with "" when you provide it as data
saury commented 4 years ago

Using a file works as expected. Thanks.