cors-tester
cors-tester is used for testing CORS-request to a server. Makes a XHR request to a specified endpoint. Whole process takes about 2 seconds.
Getting started
Download cors-tester
npm install cors-tester
Using cors-tester
var corsTesterLib = ;//Full return values, with errors and responsescorsTesterLib; //OR a very simplified responsecorsTesterLib; //These will make a GET request from Origin: http://localhost:4006 to the specified url//Which means that the server should return proper Access-Control headers allowing http://localhost:4006 to access // The first parameter can also be an object with the following variablesvar config = port: 4447 //Default=4006 url: 'http://localhost:9000' method: 'POST' //Default="GET";corsTesterLib;
How it works
- Setups a node.js http-server that serves a single html file
- The file is opened by Phantom.js browser with url-parameters
- The html contains a script that makes a XHR-request to an url specified in the url-parameters
- The application catches XHR-requests and responses and delivers them to the user
Testing
npm test