yingsa/server/test-upload.js
Ethanfly 2ee017bccf feat(branding): Update logo and favicon assets across all platforms
- Replace favicon.svg in admin panel with new brand logo design
- Add logo.png and logo.svg files to dedicated logo directory
- Update miniprogram with new logo assets (logo.png and logo.svg)
- Add README-UPLOAD.md documentation for miniprogram upload functionality
- Update miniprogram app.js and config.js for logo integration
- Update miniprogram user page (pages/user/index.js) to use new branding
- Update server upload route to handle new logo assets
- Add test-upload.js for upload functionality testing
- Update server .env configuration for asset handling
- Standardize brand visual identity across admin, miniprogram, and server platforms
2026-02-03 17:26:02 +08:00

37 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 测试上传接口
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const path = require('path');
async function testUpload() {
try {
// 首先测试健康检查
console.log('1. 测试健康检查...');
const healthRes = await axios.get('http://127.0.0.1:3001/health');
console.log('✓ 健康检查通过:', healthRes.data);
// 测试上传路由是否存在不带token
console.log('\n2. 测试上传路由无token...');
try {
await axios.post('http://127.0.0.1:3001/api/upload/avatar');
} catch (err) {
if (err.response) {
console.log('✓ 路由存在,返回状态:', err.response.status);
console.log(' 响应:', err.response.data);
} else {
console.log('✗ 请求失败:', err.message);
}
}
console.log('\n测试完成');
console.log('\n如果看到404错误说明路由没有正确注册。');
console.log('如果看到401错误说明路由存在但需要认证。');
console.log('如果看到400错误说明路由正常工作。');
} catch (error) {
console.error('测试失败:', error.message);
}
}
testUpload();