Skip to content

Commit

Permalink
linked solutions to the challenges page rather than eviltester.com
Browse files Browse the repository at this point in the history
  • Loading branch information
eviltester committed Mar 17, 2024
1 parent c1c2ab5 commit 1e5d9a3
Show file tree
Hide file tree
Showing 19 changed files with 391 additions and 437 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public String asHtmlAHref() {
if(linkData.isEmpty()){
return linkText;
}
return String.format("<a href='%s' target='_blank'>%s</a>",linkData, linkText);

String target="target='_blank'";
if(!linkData.startsWith("http")){
target="";
}
return String.format("<a href='%s' %s>%s</a>",linkData, target, linkText);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static ChallengeDefinitionData createChallenger201(int challengeOrder) {
);
aChallenge.addHint("In multi-user mode, you need to create an X-CHALLENGER Session first", "/gui/multiuser.html");
aChallenge.addSolutionLink("Send request using POST to /challenger endpoint. The response has an X-CHALLENGER header, add this header X-CHALLENGER and the GUID value to all future requests.","","");
aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/post-challenger-201");
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/create-session/post-challenger-201");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "tNGuZMQgHxw");
return aChallenge;
}
Expand All @@ -28,7 +28,7 @@ public static ChallengeDefinitionData getRestoreExistingChallenger200(int challe
aChallenge.addHint("Remember to add the X-CHALLENGER header to track your progress", "");
aChallenge.addHint("Add the guid in the URL as the last part of the path", "");
aChallenge.addSolutionLink("GET /challenger/{guid} for a challenger previously saved in the persistence store", "", "");
//aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/post-challenger-201");
//aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/post-create/post-challenger-201");
//aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "tNGuZMQgHxw");
return aChallenge;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static ChallengeDefinitionData deleteTodosId200(int challengeOrder) {
aChallenge.addHint("Make sure you don't use {id} in the url, replace that with the id of a todo e.g. /todos/1");
aChallenge.addHint("Make sure a todo with the id exists prior to issuing the request");
aChallenge.addHint("Check it was deleted by issuing a GET or HEAD on the /todos/{id}");
aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/delete-todos-id-200");
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/delete/delete-todos-id-200");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "6MXTkaXn9qU");

return aChallenge;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static ChallengeDefinitionData getChallenges200(int challengeOrder) {
"GET /challenges (200)",
"Issue a GET request on the `/challenges` end point");

aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/get-challenges-200/");
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/first-challenge/get-challenges-200");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "DrAjk2NaPRo");

return aChallenge;
Expand All @@ -23,7 +23,7 @@ public static ChallengeDefinitionData getTodos200(int challengeOrder) {
"GET /todos (200)",
"Issue a GET request on the `/todos` end point");

aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/get-todos-200");
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/get/get-todos-200");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "OpisB0UZq0c");

return aChallenge;
Expand All @@ -35,7 +35,7 @@ public static ChallengeDefinitionData getTodos404(int challengeOrder) {
"GET /todo (404) not plural",
"Issue a GET request on the `/todo` end point should 404 because nouns should be plural");

aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/get-todo-404");
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/get/get-todo-404");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "gAJzqgcN9dc");

return aChallenge;
Expand All @@ -48,7 +48,7 @@ public static ChallengeDefinitionData getTodo200(int challengeOrder) {
"Issue a GET request on the `/todos/{id}` end point to return a specific todo");

aChallenge.addHint("Make sure you don't use {id} in the url, replace that with the id of a todo e.g. /todos/1");
aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/get-todos-id-200");
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/get/get-todos-id-200");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "JDbbSY3U_rY");

return aChallenge;
Expand All @@ -63,7 +63,7 @@ public static ChallengeDefinitionData getTodo404(int challengeOrder) {
aChallenge.addHint("Make sure you don't use {id} in the url, replace that with the id of a todo e.g. /todos/1");
aChallenge.addHint("Make sure the id is an integer e.g. /todos/1");
aChallenge.addHint("Make sure you are using the /todos end point e.g. /todos/1");
aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/get-todos-id-404");
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/get/get-todos-id-404");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "1S5kpd8-xfM");

return aChallenge;
Expand All @@ -78,7 +78,7 @@ public static ChallengeDefinitionData getTodosFiltered200(int challengeOrder) {
aChallenge.addHint("A URL parameter is added to the end of a url with a ? e.g. /todos?id=1");
aChallenge.addHint("To filter on 'done' we use the 'doneStatus' field ? e.g. ?doneStatus=true");
aChallenge.addHint("Make sure there are todos which are done, and not yet done");
aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/get-todos-200-filter");
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/get/get-todos-200-filter");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "G-sLuhyPMuw");
return aChallenge;
}
Expand All @@ -102,7 +102,7 @@ public static ChallengeDefinitionData getTodosAcceptXML200(int challengeOrder) {
"GET /todos (200) XML",
"Issue a GET request on the `/todos` end point with an `Accept` header of `application/xml` to receive results in XML format");

aChallenge.addSolutionLink("Read Solution", "HREF","https://www.eviltester.com/apichallenges/howto/get-todos-xml-200/");
aChallenge.addSolutionLink("Read Solution", "HREF","/apichallenges/solutions/accept-header/get-todos-200-xml");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "cLeEuZm2VG8");
return aChallenge;
}
Expand All @@ -113,7 +113,7 @@ public static ChallengeDefinitionData getTodosAcceptJson200(int challengeOrder)
"GET /todos (200) JSON",
"Issue a GET request on the `/todos` end point with an `Accept` header of `application/json` to receive results in JSON format");

aChallenge.addSolutionLink("Read Solution", "HREF","https://www.eviltester.com/apichallenges/howto/get-todos-json-200/");
aChallenge.addSolutionLink("Read Solution", "HREF","/apichallenges/solutions/accept-header/get-todos-200-json");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "79JTHiby2Qw");
return aChallenge;
}
Expand All @@ -124,7 +124,7 @@ public static ChallengeDefinitionData getTodosAcceptAny200(int challengeOrder) {
"GET /todos (200) ANY",
"Issue a GET request on the `/todos` end point with an `Accept` header of `*/*` to receive results in default JSON format");

aChallenge.addSolutionLink("Read Solution", "HREF","https://www.eviltester.com/apichallenges/howto/get-todos-any-200/");
aChallenge.addSolutionLink("Read Solution", "HREF","/apichallenges/solutions/accept-header/get-todos-200-any");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "O4DhJ8Ohkk8");
return aChallenge;
}
Expand All @@ -135,7 +135,7 @@ public static ChallengeDefinitionData getTodosPreferAcceptXML200(int challengeOr
"GET /todos (200) XML pref",
"Issue a GET request on the `/todos` end point with an `Accept` header of `application/xml, application/json` to receive results in the preferred XML format");

aChallenge.addSolutionLink("Read Solution", "HREF","https://www.eviltester.com/apichallenges/howto/get-todos-xml-preference-200/");
aChallenge.addSolutionLink("Read Solution", "HREF","/apichallenges/solutions/accept-header/get-todos-200-xml-pref");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "sLChuy9pc9U");
return aChallenge;
}
Expand All @@ -146,7 +146,7 @@ public static ChallengeDefinitionData getTodosNoAccept200(int challengeOrder) {
"GET /todos (200) no accept",
"Issue a GET request on the `/todos` end point with no `Accept` header present in the message to receive results in default JSON format");

aChallenge.addSolutionLink("Read Solution", "HREF","https://www.eviltester.com/apichallenges/howto/get-todos-no-accept-200/");
aChallenge.addSolutionLink("Read Solution", "HREF","/apichallenges/solutions/accept-header/get-todos-200-no-accept");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "CSVP2PcvOdg");
return aChallenge;
}
Expand All @@ -157,7 +157,7 @@ public static ChallengeDefinitionData getTodosUnavailableAccept406(int challenge
"GET /todos (406)",
"Issue a GET request on the `/todos` end point with an `Accept` header `application/gzip` to receive 406 'NOT ACCEPTABLE' status code");

aChallenge.addSolutionLink("Read Solution", "HREF","https://www.eviltester.com/apichallenges/howto/19-get-todos-invalid-accept-406/");
aChallenge.addSolutionLink("Read Solution", "HREF","/apichallenges/solutions/accept-header/get-todos-406");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "QzfbegkY1ok");
return aChallenge;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static ChallengeDefinitionData headTodos200(int challengeOrder) {
"HEAD /todos (200)",
"Issue a HEAD request on the `/todos` end point");

aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/head-todos-200");
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/head/head-todos-200");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "zKbytTelP84"); return aChallenge;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static ChallengeDefinitionData optionsTodos200(int challengeOrder) {
"OPTIONS /todos (200)",
"Issue an OPTIONS request on the `/todos` end point. You might want to manually check the 'Allow' header in the response is as expected.");

aChallenge.addSolutionLink("Read Solution", "HREF","https://www.eviltester.com/apichallenges/howto/options-todos-200/");
aChallenge.addSolutionLink("Read Solution", "HREF","/apichallenges/solutions/options/options-todos-200");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "Ld5h1TSnXWA");

return aChallenge;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static ChallengeDefinitionData postTodos201(int challengeOrder) {
"POST /todos (201)",
"Issue a POST request to successfully create a todo");

aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/post-todos-201");
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/post-create/post-todos-201");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "T0LFHwavsNA");
return aChallenge;
}
Expand All @@ -40,7 +40,7 @@ public static ChallengeDefinitionData postTodosBadDoneStatus400(int challengeOrd
"POST /todos (400) doneStatus",
"Issue a POST request to create a todo but fail validation on the `doneStatus` field");

aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/post-todos-400");
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/post-create/post-todos-400");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "tlye5bQ72g0");
return aChallenge;
}
Expand Down Expand Up @@ -109,7 +109,7 @@ public static ChallengeDefinitionData postTodosId200(int challengeOrder) {
"Issue a POST request to successfully update a todo");

aChallenge.addHint("Make sure you don't use {id} in the url, replace that with the id of a todo e.g. /todos/1");
aChallenge.addSolutionLink("Read Solution", "HREF", "https://www.eviltester.com/apichallenges/howto/post-todos-id-200");
aChallenge.addSolutionLink("Read Solution", "HREF", "/apichallenges/solutions/post-update/post-todos-id-200");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "feXdRpZ_tgs");
return aChallenge;
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public static ChallengeDefinitionData postCreateTodoWithXMLAcceptXML(int challen
"POST /todos XML",
"Issue a POST request on the `/todos` end point to create a todo using Content-Type `application/xml`, and Accepting only XML ie. Accept header of `application/xml`");

aChallenge.addSolutionLink("Read Solution", "HREF","https://www.eviltester.com/apichallenges/howto/20-post-todos-xml/");
aChallenge.addSolutionLink("Read Solution", "HREF","/apichallenges/solutions/content-type-header/post-todos-xml");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "2-KBYHwb7MM");
return aChallenge;
}
Expand All @@ -151,7 +151,7 @@ public static ChallengeDefinitionData postCreateTodoWithJsonAcceptJson(int chall
"POST /todos JSON",
"Issue a POST request on the `/todos` end point to create a todo using Content-Type `application/json`, and Accepting only JSON ie. Accept header of `application/json`");

aChallenge.addSolutionLink("Read Solution", "HREF","https://www.eviltester.com/apichallenges/howto/21-post-todos-json/");
aChallenge.addSolutionLink("Read Solution", "HREF","/apichallenges/solutions/content-type-header/post-todos-json");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "VS9qIhgp51Q");
return aChallenge;
}
Expand All @@ -163,7 +163,7 @@ public static ChallengeDefinitionData postCreateUnsupportedContentType415(int ch
"POST /todos (415)",
"Issue a POST request on the `/todos` end point with an unsupported content type to generate a 415 status code");

aChallenge.addSolutionLink("Read Solution", "HREF","https://www.eviltester.com/apichallenges/howto/22-post-todos-unsupported-415/");
aChallenge.addSolutionLink("Read Solution", "HREF","/apichallenges/solutions/content-type-header/post-todos-415");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "L8H-vkbXyr0");
return aChallenge;
}
Expand All @@ -180,7 +180,7 @@ public static ChallengeDefinitionData postTodosXmlToJson201(int challengeOrder)
"POST /todos XML to JSON",
"Issue a POST request on the `/todos` end point to create a todo using Content-Type `application/xml` but Accept `application/json`");

aChallenge.addSolutionLink("Read Solution", "HREF","https://www.eviltester.com/apichallenges/howto/23-post-xml-accept-json/");
aChallenge.addSolutionLink("Read Solution", "HREF","/apichallenges/solutions/mix-accept-content/post-xml-accept-json");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "kfe7VtaV7u0");
return aChallenge;
}
Expand All @@ -192,7 +192,7 @@ public static ChallengeDefinitionData postTodosJsonToXml201(int challengeOrder)
"POST /todos JSON to XML",
"Issue a POST request on the `/todos` end point to create a todo using Content-Type `application/json` but Accept `application/xml`");

aChallenge.addSolutionLink("Read Solution", "HREF","https://www.eviltester.com/apichallenges/howto/24-post-json-accept-xml/");
aChallenge.addSolutionLink("Read Solution", "HREF","/apichallenges/solutions/mix-accept-content/post-json-accept-xml");
aChallenge.addSolutionLink("Watch Insomnia Solution", "YOUTUBE", "uw1Jq8t1em4");
return aChallenge;
}
Expand Down
Loading

0 comments on commit 1e5d9a3

Please sign in to comment.