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/$%7Burl%7D?q=fetch&page=2&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 14491 results for "fetch"(2841ms)

Migrating Deprecated HTTP Vals557 words

https://docs.val.town/troubleshooting/migrating-deprecated-http-vals/
request handler, and they’ll be cached between requests: // Expensive initialization or data fetching. const expensiveData = await fetchLargeDataset(); const cache = new Map(); export default async function (req: Request):

Sections

Intentionally caching values for performance!

request handler, and they’ll be cached between requests: // Expensive initialization or data fetching. const expensiveData = await fetchLargeDataset(); const cache = new Map(); export default async function (req: Request):

Runtime153 words

https://docs.val.town/reference/runtime/
to environment variables. The experimental Temporal API is enabled. Included environment. Section titled “Included environment” fetch to make HTTP requests. import from npm and https. Custom Types View the custom

Sections

Included environment

Included environment. Section titled “Included environment” fetch to make HTTP requests. import from npm and https. Custom Types View the custom types we support

Permissions935 words

https://docs.val.town/reference/permissions/
url: "http://localhost:3001/v1/fetch?url=https%3A%2F%2Fuser-secretEndpoint.web.val.run". } By supplying the environment variable in a header, I’m allowed access: With authenticationRun in Val Town ↗ import { fetch } from "https://esm.town/v/std/fetch"; const response = await

Sections

Exposing your vals to the internet

url: "http://localhost:3001/v1/fetch?url=https%3A%2F%2Fuser-secretEndpoint.web.val.run". } By supplying the environment variable in a header, I’m allowed access: With authenticationRun in Val Town ↗ import { fetch } from "https://esm.town/v/std/fetch"; const response = await

Upgrade to Deno728 words

https://docs.val.town/upgrading/upgrade-to-deno/
is to make room for the browser-standard Response type that is the result of a fetch request. The following image shows all three types used in parallel: req.body is no

Sections

ExpressJS types moved to express namespace

is to make room for the browser-standard Response type that is the result of a fetch request. The following image shows all three types used in parallel:

proxydatasaver.ts11 matches

@jrc•Updated 1 hour ago
44}
45
46interface FetchResult {
47 html: string;
48 contentLength: number;
50}
51
52async function fetchContent(
53 url: string,
54 reqHeaders: Headers,
55): Promise<FetchResult | null> {
56 console.log(`Fetching URL: ${url}`);
57
58 // Copy certain headers from the original request
66 // });
67
68 // Add Accept-Encoding header to request common compression types supported by fetch()
69 headers["accept-encoding"] = "gzip, deflate, br";
70
71 console.debug(`DEBUG: -> Request headers:`, headers);
72
73 const response = await fetch(url, { headers });
74 console.debug(`DEBUG: -> Status: ${response.status}`);
75
76 if (!response.ok) {
77 console.error(
78 `Failed to fetch ${url}: ${response.status} ${response.statusText}`,
79 );
80 return null;
596
597 try {
598 const fetchResult = await fetchContent(targetUrl, req.headers);
599 if (!fetchResult) {
600 return new Response("Failed to fetch content", { status: 502 });
601 }
602
603 const { html, contentLength, compression } = fetchResult;
604
605 let processingMode = determineProcessingMode(req.url, targetUrl, html);

qkwnew02_http.tsx1 match

@fengyuan_he•Updated 2 hours ago
11 forwardedHeaders.delete("host");
12
13 const res = await fetch(targetUrl, {
14 method: req.method,
15 headers: forwardedHeaders,

testWeatherFetcher1 file match

@sjaskeprut•Updated 2 days ago

weatherFetcher1 file match

@sjaskeprut•Updated 2 days ago