MCPcopy Index your code
hub / github.com/solidjs/solid-start / initializeResponse

Function initializeResponse

packages/start/src/fns/client.ts:27–66  ·  view source on GitHub ↗
(
  base: string,
  id: string,
  instance: string,
  options: RequestInit,
  args: any[],
)

Source from the content-addressed store, hash-verified

25}
26
27async function initializeResponse(
28 base: string,
29 id: string,
30 instance: string,
31 options: RequestInit,
32 args: any[],
33) {
34 // No args, skip serialization
35 if (args.length === 0) {
36 return createRequest(base, id, instance, options);
37 }
38 // For single arguments, we can directly encode as body
39 if (args.length === 1) {
40 const body = args[0];
41 const result = getHeadersAndBody(body);
42 if (result) {
43 return createRequest(base, id, instance, {
44 ...options,
45 body: result.body,
46 headers: {
47 ...options.headers,
48 ...result.headers,
49 },
50 });
51 }
52 }
53 // Fallback to seroval
54 return createRequest(base, id, instance, {
55 ...options,
56 // TODO(Alexis): move to serializeToJSONStream
57 body: await serializeToJSONString(args),
58 // duplex: 'half',
59 // body: serializeToJSONStream(args),
60 headers: {
61 ...options.headers,
62 "Content-Type": "text/plain",
63 [BODY_FORMAT_KEY]: BodyFormat.Seroval,
64 },
65 });
66}
67
68async function fetchServerFunction(
69 base: string,

Callers 1

fetchServerFunctionFunction · 0.85

Calls 3

getHeadersAndBodyFunction · 0.90
serializeToJSONStringFunction · 0.90
createRequestFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…