初始提交:ai-review 项目当前版本(含赛道一/二提交规范修订与时间节点文档)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
const BASE = 'http://localhost:3002';
|
||||
const PID = 'b1b5884e-ba85-4d8f-9a92-e524603587a0';
|
||||
|
||||
async function main() {
|
||||
const login = await fetch(`${BASE}/api/auth/login`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ password: '620f4c96' })
|
||||
});
|
||||
const { token } = await login.json();
|
||||
const auth = { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` };
|
||||
|
||||
// Test: send entry with different payload
|
||||
for (const body of [
|
||||
{ title: 'test1', repo_url: 'https://example.com/r1.git' },
|
||||
{ title: 'test2', repo_url: 'https://example.com/r2.git', category_tag: '' },
|
||||
]) {
|
||||
const r = await fetch(`${BASE}/api/projects/${PID}/entries`, {
|
||||
method: 'POST', headers: auth,
|
||||
body: JSON.stringify(body)
|
||||
});
|
||||
const text = await r.text();
|
||||
console.log(`body=${JSON.stringify(body)} status=${r.status} response=${text.slice(0, 100)}`);
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
Reference in New Issue
Block a user