FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
project logo
slavakhttpdelay
Response a specified message with HTTP status code and delay
Public
Like
1
httpdelay
Home
Code
2
README.md
H
http.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
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.
Sign up now
Code
/
Code
/
Search
http.tsx
https://slavak--3ed87fb442a811f0a11576b3cceeab13.web.val.run
README.md

httpdelay

A tiny service to get a response with a specified message and a custom HTTP status code with a delay (in milliseconds).

usage

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)

inspired by Perl oneliner

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
HTTP
  • http.tsx
    slavak--3ed87fb442a811f0a11576b3cceeab13.web.val.run
Code
README.md
H
http.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.