Skip to content

Instantly share code, notes, and snippets.

@jpomykala
Created November 13, 2024 15:13
Show Gist options
  • Save jpomykala/68822225bbea9c76afd670c89a07a9a6 to your computer and use it in GitHub Desktop.
Save jpomykala/68822225bbea9c76afd670c89a07a9a6 to your computer and use it in GitHub Desktop.
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