chore: removed axios#7685
Conversation
6935a10 to
e11867c
Compare
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
Review Summary by QodoReplace axios HTTP client with native fetch API and undici
WalkthroughsDescription• Replace axios HTTP client with native fetch API • Add undici ProxyAgent for proxy support • Simplify HTTP request handling across CLI tools • Remove axios dependency from package.json Diagramflowchart LR
axios["axios HTTP client"] -->|removed| fetch["Native fetch API"]
fetch -->|used in| cli["CLI tools<br/>compactPad, deletePad, etc."]
fetch -->|used in| server["Server modules<br/>UpdateCheck, installer"]
proxy["HTTP proxy support"] -->|replaced| undici["undici ProxyAgent"]
undici -->|configured in| serverProxy["src/node/server.ts"]
File Changes3. bin/createUserSession.ts
|
Code Review by Qodo
1. runTest() uses 4-space indent
|
| try { | ||
| const createRes = await fetch(`${host + endPoint('createPad')}?padID=${testPadId}`, { | ||
| headers: { | ||
| Authorization: await common.generateJWTToken(), | ||
| } | ||
| }) | ||
| .then(() => { | ||
| const req = axios.post(`${host}/p/${testPadId}/import`) | ||
| .then(() => { | ||
| console.log('Success'); | ||
| let fN = '/test.txt'; | ||
| let cT = 'text/plain'; | ||
| }, | ||
| }); | ||
| if (!createRes.ok) throw new Error(`createPad HTTP ${createRes.status}`); | ||
|
|
||
| // To be more aggressive every other test we mess with Etherpad | ||
| // We provide a weird file name and also set a weird contentType | ||
| if (number % 2 == 0) { | ||
| fN = froth().toString(); | ||
| cT = froth().toString(); | ||
| } | ||
| let fN = '/test.txt'; | ||
| let cT = 'text/plain'; | ||
| // To be more aggressive every other test we mess with Etherpad | ||
| // We provide a weird file name and also set a weird contentType | ||
| if (number % 2 == 0) { | ||
| fN = froth().toString(); | ||
| cT = froth().toString(); | ||
| } | ||
|
|
||
| const form = req.form(); | ||
| form.append('file', froth().toString(), { | ||
| filename: fN, | ||
| contentType: cT, | ||
| }); | ||
| }); | ||
| }) | ||
| .catch((err:any) => { | ||
| // @ts-ignore | ||
| throw new Error('FAILURE', err); | ||
| }) | ||
| const form = new FormData(); | ||
| form.append('file', new Blob([froth().toString()], {type: cT}), fN); | ||
| const importRes = await fetch(`${host}/p/${testPadId}/import`, { | ||
| method: 'POST', | ||
| body: form, | ||
| }); | ||
| if (!importRes.ok) throw new Error(`import HTTP ${importRes.status}`); | ||
| console.log('Success'); | ||
| } catch (err: any) { | ||
| throw new Error('FAILURE', err); | ||
| } |
There was a problem hiding this comment.
1. runtest() uses 4-space indent 📘 Rule violation ⚙ Maintainability
New code in runTest() is indented with 4 spaces instead of the required 2 spaces. This violates the repository indentation standard and reduces formatting consistency.
Agent Prompt
## Issue description
The new `runTest()` code block in `src/tests/backend/fuzzImportTest.ts` is indented with 4 spaces, violating the project requirement of 2-space indentation.
## Issue Context
This PR introduces new `try/catch` + `fetch` + `FormData` logic and the added lines are formatted with 4-space indentation.
## Fix Focus Areas
- src/tests/backend/fuzzImportTest.ts[30-57]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
No description provided.