Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
create a dynamic data to test
import axios, { Method } from 'axios';
(async (forNumber) => {
const arr = Array(10 * forNumber).fill(null).map((n, i) => i)
for (const i of arr) {
try {
const PreviousMessages = arr.slice(0, i + 1).fill(null).map((n, index) => {
return {
msg: index,
createdOn: new Date().toISOString()
}
});
const config = {
method: 'POST' as Method,
url: 'endpoint',
data: {
"msg": i,
PreviousMessages
}
};
const req = async () => {
return await axios(config)
}
const res = await req()
console.log(res.data)
} catch (e) {
console.error(e)
}
}
})(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment