httpdelay
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
http.tsx
https://slavak--3ed87fb442a811f0a11576b3cceeab13.web.val.run
A tiny service to get a response with a specified message and a custom HTTP status code with a delay (in milliseconds).
GET /<HTTP_STATUS_CODE>/<DELAY_IN_MILLISECONDS>/<RESPONSE_MESSAGE>
With "Accept: application/json" header it returns JSON
Example:
curl -v https://httpdelay.val.run/402/1500/HelloLarry
It returns "HelloLarry" content with 402 HTTP status code in 1500 ms
Notice: delay is limited to 60000 ms (60 seconds)
install Mojolicious first (cpanm Mojolicious
)
perl -Mojo -E 'get "/:code/:delay/:msg" => sub ($c) { $c->render_later; my ($code, $msg, $delay) = @{$c->stash}{qw(code msg delay)}; Mojo::IOLoop->timer(($delay / 1000) => sub { $c->res->code($code); $c->respond_to(json => { json => {msg => $msg}}, any => {text => $msg});}); }; app->start' get -v /205/1000/mew