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

Add support for OPTIONS http request method. #60

Open maxfontana90 opened 5 years ago

maxfontana90 commented 5 years ago

Currently, the api mock server its running on a different port when compared to the SPA Im trying to test with Protractor. Proxying API requests is not an option in my case.

Please add the ability to support OPTIONS http request methods so that preflight requests succeed.

mdasberg commented 5 years ago

@maxfontana90 I will look into that

SeJuDesign commented 5 years ago

In case someone is curious. The following mock file can be used as a catch all for all OPTION calls going to the API: { "name": "options", "request": { "url": "/api", "method": "OPTIONS" }, "responses": { "200": { "status": 200, "data": {}, "default": true } } }

maxfontana90 commented 5 years ago

Sorry to come in late, but I fixed this by adding the cors middleware to my express app that bootstraps ng-apimock