MCPcopy Create free account
hub / github.com/3eif/gitmotion / sendRequestToRustServer

Function sendRequestToRustServer

website/src/app/api/gource/start/route.ts:61–92  ·  view source on GitHub ↗
(
  repo_url: string,
  access_token?: string,
  settings?: GourceSettings
)

Source from the content-addressed store, hash-verified

59}
60
61async function sendRequestToRustServer(
62 repo_url: string,
63 access_token?: string,
64 settings?: GourceSettings
65) {
66 const body: any = { repo_url };
67
68 if (access_token) {
69 body.access_token = access_token;
70 }
71
72 if (settings) {
73 body.settings = settings;
74 }
75
76 console.log("Sending request to Rust server:", body);
77 console.log(`${process.env.API_URL}/start-gource`);
78 const response = await fetch(`${process.env.API_URL}/start-gource`, {
79 method: "POST",
80 headers: { "Content-Type": "application/json" },
81 body: JSON.stringify(body),
82 });
83
84 if (!response.ok) {
85 const errorText = await response.text();
86 throw new Error(
87 `HTTP error! status: ${response.status}, message: ${errorText}`
88 );
89 }
90
91 return response.json();
92}
93
94export async function POST(request: NextRequest) {
95 try {

Callers 1

POSTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected