MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / post

Function post

apps/cli/src/device-login.ts:129–141  ·  view source on GitHub ↗
(
  url: string,
  fields: Record<string, string | undefined>,
  format: "form" | "json",
)

Source from the content-addressed store, hash-verified

127 >;
128
129const post = async (
130 url: string,
131 fields: Record<string, string | undefined>,
132 format: "form" | "json",
133) =>
134 fetch(url, {
135 method: "POST",
136 headers: {
137 "content-type": format === "json" ? "application/json" : "application/x-www-form-urlencoded",
138 accept: "application/json",
139 },
140 body: format === "json" ? JSON.stringify(definedFields(fields)) : formBody(fields),
141 });
142
143const readJson = async (response: Response): Promise<Record<string, unknown>> => {
144 const text = await response.text();

Callers 3

requestDeviceCodeFunction · 0.70
pollForDeviceTokensFunction · 0.70
refreshDeviceTokensFunction · 0.70

Calls 3

definedFieldsFunction · 0.85
formBodyFunction · 0.85
fetchFunction · 0.50

Tested by

no test coverage detected