Skip to content

Commit 4d6bf36

Browse files
committed
add save restore solution and google header on content
1 parent c089a0f commit 4d6bf36

File tree

65 files changed

+137
-15
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+137
-15
lines changed

challenger/src/main/java/uk/co/compendiumdev/challenge/challenges/definitions/ChallengerChallenges.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ public static ChallengeDefinitionData getRestoreExistingChallenger200(int challe
2727
aChallenge.addHint("In multi-user mode, you need to create an X-CHALLENGER Session first and let it go idle so it is removed in the 10 minute purge", "/gui/multiuser");
2828
aChallenge.addHint("Remember to add the X-CHALLENGER header to track your progress", "");
2929
aChallenge.addHint("Add the guid in the URL as the last part of the path", "");
30+
3031
aChallenge.addSolutionLink("GET /challenger/{guid} for a challenger previously saved in the persistence store", "", "");
31-
//aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/post-create/post-challenger-201");
32+
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/manage-session/save-restore-session");
33+
3234
//aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "tNGuZMQgHxw");
3335
return aChallenge;
3436
}
@@ -42,8 +44,10 @@ public static ChallengeDefinitionData postRestoreExistingChallenger200(int chall
4244
"Issue a POST request on the `/challenger` end point, with an existing challenger GUID as the X-CHALLENGER header to restore that challenger's progress into memory."
4345
);
4446
aChallenge.addHint("In multi-user mode, you need to create an X-CHALLENGER Session first and let it go idle so it is removed in the 10 minute purge", "/gui/multiuser");
47+
4548
aChallenge.addSolutionLink("POST /challenger with the challenger GUID in the X-CHALLENGER header for a challenger previously saved in the persistence store", "", "");
46-
//aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/post-challenger-201");
49+
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/manage-session/save-restore-session");
50+
4751
//aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "tNGuZMQgHxw");
4852

4953
return aChallenge;
@@ -57,7 +61,8 @@ public static ChallengeDefinitionData getRestorableExistingChallengerProgress200
5761
);
5862
aChallenge.addHint("A challenger must have been created already for this to work", "");
5963
aChallenge.addHint("Remember to add the X-CHALLENGER header to track your progress", "");
60-
//aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/post-challenger-201");
64+
65+
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/manage-session/save-restore-session");
6166
//aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "tNGuZMQgHxw");
6267

6368
return aChallenge;
@@ -72,8 +77,10 @@ public static ChallengeDefinitionData putRestoreChallengerProgress200(int challe
7277
aChallenge.addHint("Use the challenger payload returned from the earlier GET request", "");
7378
aChallenge.addHint("Remember to add the X-CHALLENGER header to track your progress", "");
7479
aChallenge.addHint("The challenger should already exist in memory and this will restore status to an earlier point", "");
80+
7581
aChallenge.addSolutionLink("Using the payload from the earlier 'GET /challenger/guid' request, use PUT to reset the challenger progress", "", "");
76-
//aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/post-challenger-201");
82+
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/manage-session/save-restore-session");
83+
7784
//aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "tNGuZMQgHxw");
7885

7986
return aChallenge;
@@ -88,8 +95,10 @@ public static ChallengeDefinitionData putRestoreChallengerProgress201(int challe
8895
aChallenge.addHint("Use the challenger payload returned from the earlier GET request", "");
8996
aChallenge.addHint("Remember to add the X-CHALLENGER header to track your progress", "");
9097
aChallenge.addHint("This will create the Challenger in memory because it should not already exist", "");
98+
9199
aChallenge.addSolutionLink("Using the payload from the earlier 'GET /challenger/guid' request, use PUT to reset the challenger progress", "", "");
92-
//aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/post-challenger-201");
100+
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/manage-session/save-restore-session");
101+
93102
//aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "tNGuZMQgHxw");
94103

95104
return aChallenge;
@@ -102,7 +111,8 @@ public static ChallengeDefinitionData getRestorableTodos200(int challengeOrder)
102111
"Issue a GET request on the `/challenger/database/{guid}` end point, to retrieve the current todos database for the user. You can use this to restore state later."
103112
);
104113
aChallenge.addHint("Remember to add the X-CHALLENGER header to track your progress", "");
105-
//aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/post-challenger-201");
114+
115+
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/manage-session/save-restore-session");
106116
//aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "tNGuZMQgHxw");
107117

108118
return aChallenge;
@@ -116,8 +126,10 @@ public static ChallengeDefinitionData putRestorableTodos204(int challengeOrder)
116126
);
117127
aChallenge.addHint("Use the Todos database payload returned from the earlier GET request", "");
118128
aChallenge.addHint("Remember to add the X-CHALLENGER header to track your progress", "");
129+
119130
aChallenge.addSolutionLink("Using the payload from the earlier 'GET /challenger/database/guid' request, use PUT to reset the challenger todos data", "", "");
120-
//aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/post-challenger-201");
131+
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/manage-session/save-restore-session");
132+
121133
//aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "tNGuZMQgHxw");
122134

123135
return aChallenge;

challenger/src/main/java/uk/co/compendiumdev/challenge/gui/MarkdownContentManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ public String getHtmlVersionOfMarkdownContent(String contentFolder, String conte
168168
logger.error("Markdown parsing error", e);
169169
}
170170

171+
if(mdheaders.contains("showads: true")) {
172+
headerInject = headerInject +
173+
"<script async src=\"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7132305589272099\"" +
174+
" crossorigin=\"anonymous\"></script>";
175+
}
171176

172177
headerInject = headerInject + youtubeHeaderInject;
173178

challenger/src/main/resources/content/apichallenges.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: About The API Challenges
33
description: A brief overview of the API challenges and how to use them as a self-guided learning path for API Testing
4+
showads: true
45
---
56

67
# API Challenges

challenger/src/main/resources/content/apichallenges/solutions.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: API Challenges Solution Index
33
description: A list of all the solutions for the API Challenges. Try them yourself, but if you get stuck, we have instructions and solution videos.
4+
showads: true
45
---
56

67
# API Challenge Solutions
@@ -76,10 +77,11 @@ description: A list of all the solutions for the API Challenges. Try them yourse
7677

7778
## Fancy a Break? Restore your session
7879

79-
- GET /challenger/guid (existing X-CHALLENGER)
80-
- PUT /challenger/guid RESTORE
81-
- GET /challenger/database/guid (200)
82-
- PUT /challenger/database/guid (Update)
80+
- [Solve the Save and Restore Session Challenges](/apichallenges/solutions/manage-session/save-restore-session)
81+
- GET /challenger/guid (existing X-CHALLENGER)
82+
- PUT /challenger/guid RESTORE
83+
- GET /challenger/database/guid (200)
84+
- PUT /challenger/database/guid (Update)
8385

8486
## Mix Accept and Content-Type Challenges
8587

challenger/src/main/resources/content/apichallenges/solutions/accept-header/get-todos-200-any.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
date: 2021-05-29T09:30:00Z
33
title: API Challenges Solution For - GET todos any 200
44
description: How to solve API challenge GET todos any 200 to accept the todos in default format.
5+
showads: true
56
---
67

78
# GET all the todos in default format

challenger/src/main/resources/content/apichallenges/solutions/accept-header/get-todos-200-json.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
date: 2021-05-09T09:30:00Z
33
title: API Challenges Solution For - GET todos json 200
44
description: How to solve API challenge GET todos json 200 to accept the todos in json format.
5+
showads: true
56
---
67

78
# GET all the todos in JSON format

challenger/src/main/resources/content/apichallenges/solutions/accept-header/get-todos-200-no-accept.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
date: 2021-05-29T10:32:00Z
33
title: API Challenges Solution For - GET todos No Accept Header 200
44
description: How to solve API challenge GET todos No Accept 200 to GET the todos with no accept header present.
5+
showads: true
56
---
67

78
# How to complete the challenge `GET /todos No Accept (200)`

challenger/src/main/resources/content/apichallenges/solutions/accept-header/get-todos-200-xml-pref.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
date: 2021-05-29T10:30:00Z
33
title: API Challenges Solution For - GET todos XML as Preference 200
44
description: How to solve API challenge GET todos XML 200 to accept the todos in XML format as preferred format.
5+
showads: true
56
---
67

78
# Use Accept Headers to GET XML Content as a preference

challenger/src/main/resources/content/apichallenges/solutions/accept-header/get-todos-200-xml.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
date: 2021-04-23T09:30:00Z
33
title: API Challenges Solution For - GET todos xml 200
44
description: How to solve API challenge GET todos xml 200 to accept the todos in xml format.
5+
showads: true
56
---
67

78
# How to complete the challenge `GET /todos XML (200)`

challenger/src/main/resources/content/apichallenges/solutions/accept-header/get-todos-406.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
date: 2021-07-17T10:32:00Z
33
title: API Challenges Solution For - GET todos Invalid Accept Header 406
44
description: How to solve API challenge GET todos Invalid Accept 406 to GET the todos with an unsupported accept header present which generates a 406 error response.
5+
showads: true
56
---
67

78
# How to complete the challenge `GET /todos (406)`

0 commit comments

Comments
 (0)