@@ -317,10 +317,10 @@ async function conditionsAchalasia(req, res, next) {
317317// Apigee Production environment ('apikey' required in Header)
318318// https://api.service.nhs.uk/nhs-website-content/conditions/acne/?modules=true
319319async function conditionsAcne ( req , res , next ) {
320- if ( req . query . modules . toLowerCase ( ) === 'true' ) {
321- res . status ( 200 ) . json ( conditionsAcneModulesTrueResponse )
322- } else {
320+ if ( ! req . query . modules || req . query . modules . toLowerCase ( ) === 'false' ) {
323321 res . status ( 200 ) . json ( conditionsAcneNoParamsResponse )
322+ } else if ( req . query . modules ?. toLowerCase ( ) === 'true' ) {
323+ res . status ( 200 ) . json ( conditionsAcneModulesTrueResponse )
324324 }
325325 res . end ( )
326326 next ( )
@@ -338,10 +338,10 @@ async function conditionsAcne(req, res, next) {
338338// Apigee Sandbox environment (no auth key required)
339339// https://sandbox.api.service.nhs.uk/nhs-website-content/conditions/*?modules=true
340340async function conditionsWildcard ( req , res , next ) {
341- if ( req . query . modules . toLowerCase ( ) === 'true' ) {
342- res . status ( 200 ) . json ( conditionsWildcardModulesTrueResponse )
343- } else {
341+ if ( ! req . query . modules || req . query . modules . toLowerCase ( ) === 'false' ) {
344342 res . status ( 200 ) . json ( conditionsWildcardResponseNoParams )
343+ } else if ( req . query . modules . toLowerCase ( ) === 'true' ) {
344+ res . status ( 200 ) . json ( conditionsWildcardModulesTrueResponse )
345345 }
346346 res . end ( )
347347 next ( )
@@ -595,10 +595,10 @@ async function medicinesAciclovir(req, res, next) {
595595// Apigee Production environment ('apikey' required in Header)
596596// https://api.service.nhs.uk/nhs-website-content/medicines/acrivastine/?modules=true
597597async function medicinesAcrivastine ( req , res , next ) {
598- if ( req . query . modules . toLowerCase ( ) === 'true' ) {
599- res . status ( 200 ) . json ( medicinesAcrivastineModulesTrueResponse )
600- } else {
598+ if ( ! req . query . modules || req . query . modules . toLowerCase ( ) === 'false' ) {
601599 res . status ( 200 ) . json ( medicinesAcrivastineNoParamsResponse )
600+ } else if ( req . query . modules . toLowerCase ( ) === 'true' ) {
601+ res . status ( 200 ) . json ( medicinesAcrivastineModulesTrueResponse )
602602 }
603603 res . end ( )
604604 next ( )
@@ -616,10 +616,10 @@ async function medicinesAcrivastine(req, res, next) {
616616// Apigee Sandbox environment (no auth key required)
617617// https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/*?modules=true
618618async function medicinesWildcard ( req , res , next ) {
619- if ( req . query . modules . toLowerCase ( ) === 'true' ) {
620- res . status ( 200 ) . json ( medicinesWildcardModulesTrueResponse )
621- } else {
619+ if ( ! req . query . modules || req . query . modules . toLowerCase ( ) === 'false' ) {
622620 res . status ( 200 ) . json ( medicinesWildcardNoParamsResponse )
621+ } else if ( req . query . modules . toLowerCase ( ) === 'true' ) {
622+ res . status ( 200 ) . json ( medicinesWildcardModulesTrueResponse )
623623 }
624624 res . end ( )
625625 next ( )
0 commit comments