fix(gitea TLS): 固定略過憑證驗證並改用 Gitea context

This commit is contained in:
2026-06-25 10:28:30 +00:00
parent 65f27f544b
commit 8315e1da2a
5 changed files with 13 additions and 45 deletions
+2 -2
View File
@@ -37,14 +37,14 @@ describe('gitea', () => {
assert.ok(capturedOpts.headers['Authorization'].startsWith('token '));
});
it('does not set httpsAgent by default (GITEA_SKIP_TLS_VERIFY not true)', async () => {
it('sets an insecure httpsAgent by default', async () => {
let capturedOpts;
mock.method(axios, 'get', async (_url, opts) => {
capturedOpts = opts;
return { data: '' };
});
await getPRDiff();
assert.equal(capturedOpts.httpsAgent, undefined);
assert.equal(capturedOpts.httpsAgent.options.rejectUnauthorized, false);
});
it('getPRDiff propagates axios errors', async () => {