File tree Expand file tree Collapse file tree
live/apiproxy/resources/jsc
sandbox/apiproxy/resources/jsc Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -224,10 +224,17 @@ for (var i = 0; i < searchAndReplaceStrings.length; i++) {
224224}
225225
226226var responseJsonObj = JSON . parse ( responseContent ) ;
227- responseJsonObj . webpage = responseJsonObj . url . replace (
228- "https://" + requestHostnameEnv + "/nhs-website-content/" ,
229- "https://www.nhs.uk/"
230- ) ;
227+ if ( responseJsonObj . url ) {
228+ responseJsonObj . webpage = responseJsonObj . url . replace (
229+ "https://" + requestHostnameEnv + "/nhs-website-content/" ,
230+ "https://www.nhs.uk/"
231+ ) ;
232+ } else if ( responseJsonObj . about . url ) {
233+ responseJsonObj . about . webpage = responseJsonObj . about . url . replace (
234+ "https://" + requestHostnameEnv + "/nhs-website-content/" ,
235+ "https://www.nhs.uk/"
236+ ) ;
237+ }
231238responseContent = JSON . stringify ( responseJsonObj ) ;
232239
233240context . setVariable ( "response.content" , responseContent ) ;
Original file line number Diff line number Diff line change @@ -185,10 +185,17 @@ for (var i = 0; i < searchAndReplaceStrings.length; i++) {
185185}
186186
187187var responseJsonObj = JSON . parse ( responseContent ) ;
188- responseJsonObj . webpage = responseJsonObj . url . replace (
189- "https://api.service.nhs.uk/nhs-website-content/" ,
190- "https://www.nhs.uk/"
191- ) ;
188+ if ( responseJsonObj . url ) {
189+ responseJsonObj . webpage = responseJsonObj . url . replace (
190+ "https://api.service.nhs.uk/nhs-website-content/" ,
191+ "https://www.nhs.uk/"
192+ ) ;
193+ } else if ( responseJsonObj . about . url ) {
194+ responseJsonObj . about . webpage = responseJsonObj . about . url . replace (
195+ "https://api.service.nhs.uk/nhs-website-content/" ,
196+ "https://www.nhs.uk/"
197+ ) ;
198+ }
192199responseContent = JSON . stringify ( responseJsonObj ) ;
193200
194201context . setVariable ( "response.content" , responseContent ) ;
You can’t perform that action at this time.
0 commit comments