Skip to content

Commit 19fd6af

Browse files
authored
Added search and replace Regex for ‘vaccinations’ and ‘contraception’ (#134)
1 parent 949c8e1 commit 19fd6af

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

proxies/live/apiproxy/resources/jsc/SearchAndReplaceResponse.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,68 @@ var searchAndReplaceStrings = [
226226
searchForRegex: /href=\\"\/common-health-questions\//gm,
227227
replaceWithStr: 'href=\\"https://www.nhs.uk/common-health-questions/',
228228
},
229+
{
230+
comment1: "=============================================================",
231+
comment2: "Vaccinations ",
232+
comment3: "=============================================================",
233+
},
234+
{
235+
searchForRegex: /:\s?"https:\/\/api.nhs.uk\/vaccinations\//gm,
236+
replaceWithStr:
237+
': "https://' + requestHostnameEnv + "/nhs-website-content/vaccinations/",
238+
},
239+
{
240+
searchForRegex: /:\s?"https:\/\/www.nhs.uk\/vaccinations\//gm,
241+
replaceWithStr:
242+
': "https://' + requestHostnameEnv + "/nhs-website-content/vaccinations/",
243+
},
244+
{
245+
searchForRegex: /:\s?"\/vaccinations\//gm,
246+
replaceWithStr:
247+
': "https://' + requestHostnameEnv + "/nhs-website-content/vaccinations/",
248+
},
249+
{
250+
searchForRegex: /href=\\"https:\/\/api.nhs.uk\/vaccinations\//gm,
251+
replaceWithStr: 'href=\\"https://www.nhs.uk/vaccinations/',
252+
},
253+
{
254+
searchForRegex: /href=\\"\/vaccinations\//gm,
255+
replaceWithStr: 'href=\\"https://www.nhs.uk/vaccinations/',
256+
},
257+
{
258+
comment1: "=============================================================",
259+
comment2: "Contraception ",
260+
comment3: "=============================================================",
261+
},
262+
{
263+
searchForRegex: /:\s?"https:\/\/api.nhs.uk\/contraception\//gm,
264+
replaceWithStr:
265+
': "https://' +
266+
requestHostnameEnv +
267+
"/nhs-website-content/contraception/",
268+
},
269+
{
270+
searchForRegex: /:\s?"https:\/\/www.nhs.uk\/contraception\//gm,
271+
replaceWithStr:
272+
': "https://' +
273+
requestHostnameEnv +
274+
"/nhs-website-content/contraception/",
275+
},
276+
{
277+
searchForRegex: /:\s?"\/contraception\//gm,
278+
replaceWithStr:
279+
': "https://' +
280+
requestHostnameEnv +
281+
"/nhs-website-content/contraception/",
282+
},
283+
{
284+
searchForRegex: /href=\\"https:\/\/api.nhs.uk\/contraception\//gm,
285+
replaceWithStr: 'href=\\"https://www.nhs.uk/contraception/',
286+
},
287+
{
288+
searchForRegex: /href=\\"\/contraception\//gm,
289+
replaceWithStr: 'href=\\"https://www.nhs.uk/contraception/',
290+
},
229291
];
230292

231293
var responseContent = context.getVariable("response.content");

0 commit comments

Comments
 (0)