Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$1?q=fetch&page=23&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 13304 results for "fetch"(846ms)

Townieindex.ts1 match

@PrincessJossy•Updated 2 days ago
212});
213
214export default app.fetch;

Townieindex.ts1 match

@PrincessJossy•Updated 2 days ago
21
22// This is the entry point for HTTP vals
23export default app.fetch;
24

Townieindex.ts2 matches

@PrincessJossy•Updated 2 days ago
1import { makeChangeValTypeTool } from "./change-val-type.ts";
2import { makeFetchTool } from "./fetch.ts";
3import { makeTextEditorTool } from "./text-editor.ts";
4import { thinkTool } from "./think.ts";
7 makeTextEditorTool,
8 makeChangeValTypeTool,
9 makeFetchTool,
10 thinkTool
11};

Towniefetch.ts5 matches

@PrincessJossy•Updated 2 days ago
11 * Creates a tool for making HTTP requests to vals in a Val Town project
12 */
13export const makeFetchTool = (
14 { bearerToken, project, branch_id }: { bearerToken?: string; project?: any; branch_id?: string } = {},
15) =>
16 tool({
17 name: "fetch",
18 description: "Make an HTTP request to a Val Town val and return the response. Useful for testing HTTP vals.",
19 parameters: z.object({
68 return {
69 type: "error",
70 message: `Error fetching val at path '${valPath}': ${error.message}`,
71 };
72 }
83 return {
84 type: "error",
85 message: `The val at path '${valPath}' is not an HTTP val. Only HTTP vals can be called with fetch.`,
86 };
87 }
111 let response;
112 try {
113 response = await fetch(valEndpoint + urlPath, options);
114 } catch (error: any) {
115 // Return error information

Townie.cursorrules3 matches

@PrincessJossy•Updated 2 days ago
239
240 // Inject data to avoid extra round-trips
241 const initialData = await fetchInitialData();
242 const dataScript = `<script>
243 window.__INITIAL_DATA__ = ${JSON.stringify(initialData)};
286
2875. **API Design:**
288 - `fetch` handler is the entry point for HTTP vals
289 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
290
291

TownieChatRouteSingleColumn.tsx6 matches

@PrincessJossy•Updated 2 days ago
49 files={project.data?.files}
50 branchId={branchId}
51 refetch={project.refetch}
52 />
53 </ProjectContext>
59 files,
60 branchId,
61 refetch,
62}: {
63 project: any;
64 files: any[];
65 branchId: string;
66 refetch: () => void;
67}) {
68 const [images, setImages] = useState<(string|null)[]>([]);
94 if (!messages?.length) return;
95 let last = messages.at(-1);
96 if (shouldRefetch(last)) {
97 refetch();
98 }
99 }, [messages]);
194}
195
196function shouldRefetch (message) {
197 for (let i = 0; i < message?.parts?.length; i++) {
198 let part = message.parts[i];

TownieBranchSelect.tsx1 match

@PrincessJossy•Updated 2 days ago
32 return;
33 }
34 branches.refetch();
35 if (res?.branch?.id) {
36 navigate(`/chat/${projectId}/branch/${res.branch.id}`);

ipv4-counterindex.html1 match

@maxm•Updated 2 days ago
147 async () => {
148 try {
149 const response = await fetch("/api/visits");
150 const data = await response.json();
151 updateUI(data);

cerebras_coderv2index.ts1 match

@etomberg391•Updated 2 days ago
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({

Lawyersmain.tsx12 matches

@Get•Updated 2 days ago
469 <textarea id="legal-task-query" name="legalTaskQuery" placeholder="E.g., 'Identify all clauses related to termination for cause.' or 'Summarize the key obligations of Party A.'">${escapedQuery}</textarea>
470
471 <label for="doc-url">Document URL (Optional - content will be fetched):</label>
472 <input type="text" id="doc-url" name="documentUrl" value="${escapedUrl}" placeholder="https://example.com/legal-document.html">
473
711            inputSourceDescription = \`URL: \${urlValue}\`;
712            formData.append('documentUrl', urlValue);
713            addStatusMessage(\`Fetching and processing content from URL: \${urlValue}\`, 'progress');
714        }
715        formData.append('inputSourceDescription', inputSourceDescription);
717
718        try {
719            const response = await fetch(window.location.pathname + '?format=json', {
720                method: 'POST',
721                body: formData,
775 // Check if a "Starting analysis..." message exists and remove it or similar progress ones
776 const existingProgress = statusContainer.querySelector('.status-entry.progress');
777 if(existingProgress && (existingProgress.textContent.includes('Starting analysis...') || existingProgress.textContent.includes('Uploading and processing') || existingProgress.textContent.includes('Fetching and processing') || existingProgress.textContent.includes('Processing pasted text'))) {
778 // Don't clear all if server logs were already added
779 } else {
815 const { OpenAI } = await import("https://esm.town/v/std/openai");
816 const { z } = await import("npm:zod"); // For potential future robust input validation on server
817 const { fetch } = await import("https://esm.town/v/std/fetch");
818 const { PDFExtract, PDFExtractOptions } = await import("npm:pdf.js-extract");
819
939 documentText = input.documentText;
940 } else if (input.documentUrl) {
941 log.push({ agent: ingestionAgent, type: "step", message: `Fetching from URL: ${input.documentUrl}` });
942 try {
943 // Basic fetch, consider adding User-Agent, timeout, error handling, content-type checking
944 const response = await fetch(input.documentUrl, {
945 headers: { "Accept": "text/plain, text/html, application/pdf" },
946 }); // Accept PDF too
949 const contentType = response.headers.get("content-type") || "";
950 if (contentType.includes("application/pdf")) {
951 log.push({ agent: ingestionAgent, type: "info", message: "Fetched PDF from URL. Extracting text..." });
952 const pdfBuffer = await response.arrayBuffer();
953 documentText = await extractPdfTextNative(
962 } else { // Assume text-like
963 const text = await response.text();
964 if (!text || text.trim().length === 0) throw new Error("Fetched content is empty or not text.");
965 log.push({ agent: ingestionAgent, type: "info", message: `Fetched ~${text.length} characters from URL.` });
966 documentText = text;
967 }
968 } catch (error) {
969 const errorMessage = `Failed to fetch or process URL ${input.documentUrl}: ${error.message}`;
970 log.push({ agent: ingestionAgent, type: "error", message: errorMessage });
971 documentText = null;

GithubPRFetcher

@andybak•Updated 1 day ago

proxiedfetch1 file match

@jayden•Updated 1 day ago