Skip to content

Commit c3d50c9

Browse files
brainkimclaude
andcommitted
fix: correct repo URL in echo footer, remove delay feature
- Fix hallucinated anthropics/shovel URL to bikeshaving/shovel - Remove X-Echo-Delay (burns Workers CPU time for no real value) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5629b8c commit c3d50c9

1 file changed

Lines changed: 2 additions & 29 deletions

File tree

examples/echo/src/server.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ const HOMEPAGE_HTML = `
7171
<h2>Control Headers</h2>
7272
<p>Modify response behavior using <code>X-Echo-*</code> headers:</p>
7373
74-
<h3><code>X-Echo-Delay</code></h3>
75-
<p>Delay response by specified seconds (1-10).</p>
76-
<pre><code>curl https://echo.shovel.run/echo -H "X-Echo-Delay: 3"</code></pre>
77-
7874
<h3><code>X-Echo-Status</code></h3>
7975
<p>Return a specific HTTP status code (100-599).</p>
8076
<pre><code>curl https://echo.shovel.run/echo -H "X-Echo-Status: 404"</code></pre>
@@ -134,7 +130,7 @@ const HOMEPAGE_HTML = `
134130
<li>JSON, form data, and text body parsing</li>
135131
<li>Cache control headers</li>
136132
<li>Content type overrides</li>
137-
<li>Status code and delay control</li>
133+
<li>Status code control</li>
138134
<li>Clean header-based control mechanism</li>
139135
</ul>
140136
@@ -145,13 +141,12 @@ const HOMEPAGE_HTML = `
145141
<li>CORS policy validation</li>
146142
<li>Frontend integration testing</li>
147143
<li>API error handling</li>
148-
<li>Loading state demonstrations</li>
149144
<li>HTTP fundamentals learning</li>
150145
<li>Cache behavior validation</li>
151146
</ul>
152147
153148
<footer>
154-
<p>Built with <a href="https://github.com/anthropics/shovel">Shovel</a></p>
149+
<p>Built with <a href="https://github.com/bikeshaving/shovel">Shovel</a></p>
155150
</footer>
156151
</body>
157152
</html>`;
@@ -293,24 +288,10 @@ router.route("/echo").all(async (request) => {
293288
}
294289

295290
// Parse control headers
296-
const delayHeader = request.headers.get("x-echo-delay");
297291
const statusHeader = request.headers.get("x-echo-status");
298292
const cacheHeader = request.headers.get("x-echo-cache");
299293
const contentTypeHeader = request.headers.get("x-echo-content-type");
300294

301-
// Validate delay
302-
let delay = 0;
303-
if (delayHeader) {
304-
const parsed = parseInt(delayHeader);
305-
if (isNaN(parsed) || parsed < 1 || parsed > 10) {
306-
return Response.json(
307-
{error: "X-Echo-Delay must be between 1 and 10"},
308-
{status: 400, headers: corsHeaders || {}},
309-
);
310-
}
311-
delay = parsed;
312-
}
313-
314295
// Validate status
315296
let statusCode = 200;
316297
if (statusHeader) {
@@ -324,11 +305,6 @@ router.route("/echo").all(async (request) => {
324305
statusCode = parsed;
325306
}
326307

327-
// Apply delay
328-
if (delay > 0) {
329-
await new Promise((resolve) => setTimeout(resolve, delay * 1000));
330-
}
331-
332308
// Build response
333309
const info = getRequestInfo(request);
334310
const body = await parseBody(request);
@@ -339,9 +315,6 @@ router.route("/echo").all(async (request) => {
339315
contentType: request.headers.get("content-type") || null,
340316
};
341317

342-
if (delay > 0) {
343-
response.delayed = `${delay} seconds`;
344-
}
345318
if (statusCode !== 200) {
346319
response.requestedStatus = statusCode;
347320
}

0 commit comments

Comments
 (0)