Created
November 13, 2024 15:13
-
-
Save jpomykala/68822225bbea9c76afd670c89a07a9a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
import { faker } from '@faker-js/faker'; | |
async function sendRequest() { | |
const data = { | |
template: 'TEMPLATE', | |
data: { | |
'title.text': faker.lorem.sentence() | |
} | |
}; | |
try { | |
const response = await axios.post('https://api.renderform.io/api/v2/render', data, { | |
headers: { | |
'Content-Type': 'application/json', | |
'x-api-key': 'API_KEY' | |
} | |
}); | |
const currentTime = new Date().toISOString(); | |
console.log(`[${currentTime}] Request sent successfully: ${response.data.href}`); | |
} catch (error) { | |
console.error(error); | |
} | |
} | |
async function executeRequests() { | |
for (let i = 0; i < 100; i++) { | |
await sendRequest(); | |
} | |
} | |
executeRequests(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment