Skip to content

Commit 76d6e17

Browse files
committed
fix: use post to validate the challenge
1 parent bf5191c commit 76d6e17

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

public/index.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@
9191
</style>
9292
<script>
9393
function validateChallenge() {
94-
fetch("/validate")
94+
fetch("/validate", {
95+
method: "POST",
96+
headers: { "Content-Type": "text/plain" },
97+
})
9598
.then(async (data) => {
9699
document.getElementById("response").style.display = "block";
97100
document.getElementById("response").innerHTML = await data.text();

server.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function expressServer() {
3535
app.get("/index.html", (req: Request, res: Response) => {
3636
res.send(finalIndexPage);
3737
});
38-
app.get("/validate", async (req: Request, res: Response) => {
38+
app.post("/validate", async (req: Request, res: Response) => {
3939
const contract = getContract("Proxy");
4040
if (!contract) {
4141
res.status(500).send("Contract not found");
@@ -50,7 +50,7 @@ async function expressServer() {
5050
);
5151
} else {
5252
res
53-
.status(500)
53+
.status(200)
5454
.send(
5555
"Oops! 🎅 The blockchain elves couldn’t verify your transaction. Looks like you didn’t quite crack the code this time. Double-check your hashes and try again – the flag is still waiting for you under the tree! 🎄🔗"
5656
);

0 commit comments

Comments
 (0)