@@ -317,9 +317,11 @@ 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 || req . query . modules . toLowerCase ( ) === 'false' ) {
320+ if ( req . query . modules === undefined ) {
321321 res . status ( 200 ) . json ( conditionsAcneNoParamsResponse )
322- } else if ( req . query . modules ?. toLowerCase ( ) === 'true' ) {
322+ } else if ( req . query . modules . toLowerCase ( ) === 'false' ) {
323+ res . status ( 200 ) . json ( conditionsAcneNoParamsResponse )
324+ } else if ( req . query . modules . toLowerCase ( ) === 'true' ) {
323325 res . status ( 200 ) . json ( conditionsAcneModulesTrueResponse )
324326 }
325327 res . end ( )
@@ -338,7 +340,9 @@ async function conditionsAcne(req, res, next) {
338340// Apigee Sandbox environment (no auth key required)
339341// https://sandbox.api.service.nhs.uk/nhs-website-content/conditions/*?modules=true
340342async function conditionsWildcard ( req , res , next ) {
341- if ( ! req . query . modules || req . query . modules . toLowerCase ( ) === 'false' ) {
343+ if ( req . query . modules === undefined ) {
344+ res . status ( 200 ) . json ( conditionsWildcardResponseNoParams )
345+ } else if ( req . query . modules . toLowerCase ( ) === 'false' ) {
342346 res . status ( 200 ) . json ( conditionsWildcardResponseNoParams )
343347 } else if ( req . query . modules . toLowerCase ( ) === 'true' ) {
344348 res . status ( 200 ) . json ( conditionsWildcardModulesTrueResponse )
@@ -595,7 +599,9 @@ async function medicinesAciclovir(req, res, next) {
595599// Apigee Production environment ('apikey' required in Header)
596600// https://api.service.nhs.uk/nhs-website-content/medicines/acrivastine/?modules=true
597601async function medicinesAcrivastine ( req , res , next ) {
598- if ( ! req . query . modules || req . query . modules . toLowerCase ( ) === 'false' ) {
602+ if ( req . query . modules === undefined ) {
603+ res . status ( 200 ) . json ( medicinesAcrivastineNoParamsResponse )
604+ } else if ( req . query . modules . toLowerCase ( ) === 'false' ) {
599605 res . status ( 200 ) . json ( medicinesAcrivastineNoParamsResponse )
600606 } else if ( req . query . modules . toLowerCase ( ) === 'true' ) {
601607 res . status ( 200 ) . json ( medicinesAcrivastineModulesTrueResponse )
@@ -616,7 +622,9 @@ async function medicinesAcrivastine(req, res, next) {
616622// Apigee Sandbox environment (no auth key required)
617623// https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/*?modules=true
618624async function medicinesWildcard ( req , res , next ) {
619- if ( ! req . query . modules || req . query . modules . toLowerCase ( ) === 'false' ) {
625+ if ( req . query . modules === undefined ) {
626+ res . status ( 200 ) . json ( medicinesWildcardNoParamsResponse )
627+ } else if ( req . query . modules . toLowerCase ( ) === 'false' ) {
620628 res . status ( 200 ) . json ( medicinesWildcardNoParamsResponse )
621629 } else if ( req . query . modules . toLowerCase ( ) === 'true' ) {
622630 res . status ( 200 ) . json ( medicinesWildcardModulesTrueResponse )
0 commit comments