Skip to content

Instantly share code, notes, and snippets.

View younho9's full-sized avatar
πŸ‘¨β€πŸ’»

Younho Choo younho9

πŸ‘¨β€πŸ’»
View GitHub Profile
@younho9
younho9 / mock-http.js
Created July 2, 2021 01:06 — forked from jofftiquez/mock-http.js
Mock HTTP request in javascript using promise and timeout.
const mock = (success, timeout) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
if(success) {
resolve();
} else {
reject({message: 'Error'});
}
}, timeout);
});