Skip to content

Commit

Permalink
getTez: Send data as JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
harryttd committed Oct 15, 2023
1 parent 777509c commit c1dc4dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions getTez/getTez.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const requestHeaders = {
// `fetch` by default sets "Connection: keep-alive" header. Was causing
// ECONNRESET errors with localhost.
Connection: "close",
"Content-Type": "application/x-www-form-urlencoded",
"Content-Type": "application/json",
}

/* Get Info */
Expand Down Expand Up @@ -201,7 +201,7 @@ const getChallenge = async ({ address, amount, faucetUrl }: ValidatedArgs) => {
method: "POST",
headers: requestHeaders,
signal: AbortSignal.timeout(5000),
body: `address=${address}&amount=${amount}`,
body: JSON.stringify({ address, amount }),
})

const body = await response.json()
Expand Down Expand Up @@ -286,7 +286,7 @@ const verifySolution = async ({
method: "POST",
headers: requestHeaders,
signal: AbortSignal.timeout(5000),
body: `address=${address}&amount=${amount}&nonce=${nonce}&solution=${solution}`,
body: JSON.stringify({ address, amount, nonce, solution }),
})

const { txHash, challenge, challengeCounter, difficulty, message } =
Expand Down

0 comments on commit c1dc4dc

Please sign in to comment.