Code for an Azure Function that sometimes returns failure (on purposes, 75% of the time, useful for testing)
module.exports = function (context, req) { | |
if (Math.random() > 0.75) { | |
context.log('Azure Function "Fail75" is randomly (25%) returning 200 OK.'); | |
context.res = { | |
body: "Randomly (25%) returning 200 OK." | |
} | |
} | |
else { | |
context.log('Azure Function "Fail75" is randomly (75%) returning 500 as a transient error.'); | |
context.res = { | |
status: 500, // something transient | |
body: "Randomly (75%) returning 500 as a transient error." | |
}; | |
} | |
context.done(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment