diff --git a/README.md b/README.md index e4392ed..4695ecc 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ OpenMRS API in node or the browser. ## Install ```sh -npm install openmrs.js@alpha +npm install openmrs.js ``` ## Setup @@ -78,7 +78,7 @@ operations for the 'patient' tag * createPatient: Create with properties in request ``` -See the [examples](docs/examples) for further demonstrations. +See the [examples](examples) for further demonstrations. ## API Documentation diff --git a/src/openmrs.js b/src/openmrs.js index 971cf6c..cedcdf3 100644 --- a/src/openmrs.js +++ b/src/openmrs.js @@ -48,7 +48,7 @@ export default class OpenMRS { let specUrl = url; // make sure a protocol is specified - if (url.substring(0, 3) !== constants.OMRSJS_DEFAULT_PROTOCOL) { + if (url.substring(0, 4) !== constants.OMRSJS_DEFAULT_PROTOCOL) { specUrl = `${constants.OMRSJS_DEFAULT_PROTOCOL}://${specUrl}`; } diff --git a/test/openmrs.spec.js b/test/openmrs.spec.js index c596b90..cc4f2c6 100644 --- a/test/openmrs.spec.js +++ b/test/openmrs.spec.js @@ -141,6 +141,7 @@ describe('Contructing a new instance of OpenMRS with the base URL and protocol', it('should succeed with just the user and password', () => { fauxJax.on('request', (req) => { + expect(req.requestURL).to.be.equal('http://localhost:8080/openmrs/module/webservices/rest/swagger.json'); req.respond(200, { 'Content-Type': 'application/json', }, JSON.stringify(swaggerSpec)); @@ -169,6 +170,7 @@ describe('Contructing a new instance of OpenMRS with the full URL without protoc it('should succeed with just the user and password', () => { fauxJax.on('request', (req) => { + expect(req.requestURL).to.be.equal('http://localhost:8080/openmrs/module/webservices/rest/swagger.json'); req.respond(200, { 'Content-Type': 'application/json', }, JSON.stringify(swaggerSpec)); @@ -197,6 +199,7 @@ describe('Contructing a new instance of OpenMRS with the base URL without protoc it('should succeed with just the user and password', () => { fauxJax.on('request', (req) => { + expect(req.requestURL).to.be.equal('http://localhost:8080/openmrs/module/webservices/rest/swagger.json'); req.respond(200, { 'Content-Type': 'application/json', }, JSON.stringify(swaggerSpec)); @@ -231,6 +234,7 @@ describe('Contructing a new instance of OpenMRS with the config object', () => { it('should succeed with no parameters', () => { fauxJax.on('request', (req) => { + expect(req.requestURL).to.be.equal('http://localhost:8080/openmrs/module/webservices/rest/swagger.json'); req.respond(200, { 'Content-Type': 'application/json', }, JSON.stringify(swaggerSpec));