Skip to content

Commit

Permalink
fix: Use URLSearchParams instead of querystring (#77)
Browse files Browse the repository at this point in the history
querystring is deprecated.
  • Loading branch information
meyfa authored Oct 8, 2022
1 parent f5507a6 commit 99200cf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import axios from 'axios'
import querystring from 'querystring'

/**
* URL of the verification endpoint.
Expand Down Expand Up @@ -81,11 +80,11 @@ function createInstance (config?: RecaptchaVerifierConfig): RecaptchaVerifier {
if (secret == null) {
throw new Error('secret not configured')
}
const postBody = querystring.stringify({
const postBody = new URLSearchParams({
secret,
response,
remoteip: remoteAddress ?? undefined
})
remoteip: remoteAddress ?? ''
}).toString()
const { data } = await axios.post(VERIFY_ENDPOINT, postBody, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
Expand Down

0 comments on commit 99200cf

Please sign in to comment.