mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix (#958)
This commit is contained in:
@@ -113,7 +113,7 @@ describe('IdeClient', () => {
|
|||||||
'utf8',
|
'utf8',
|
||||||
);
|
);
|
||||||
expect(StreamableHTTPClientTransport).toHaveBeenCalledWith(
|
expect(StreamableHTTPClientTransport).toHaveBeenCalledWith(
|
||||||
new URL('http://localhost:8080/mcp'),
|
new URL('http://127.0.0.1:8080/mcp'),
|
||||||
expect.any(Object),
|
expect.any(Object),
|
||||||
);
|
);
|
||||||
expect(mockClient.connect).toHaveBeenCalledWith(mockHttpTransport);
|
expect(mockClient.connect).toHaveBeenCalledWith(mockHttpTransport);
|
||||||
@@ -181,7 +181,7 @@ describe('IdeClient', () => {
|
|||||||
await ideClient.connect();
|
await ideClient.connect();
|
||||||
|
|
||||||
expect(StreamableHTTPClientTransport).toHaveBeenCalledWith(
|
expect(StreamableHTTPClientTransport).toHaveBeenCalledWith(
|
||||||
new URL('http://localhost:9090/mcp'),
|
new URL('http://127.0.0.1:9090/mcp'),
|
||||||
expect.any(Object),
|
expect.any(Object),
|
||||||
);
|
);
|
||||||
expect(mockClient.connect).toHaveBeenCalledWith(mockHttpTransport);
|
expect(mockClient.connect).toHaveBeenCalledWith(mockHttpTransport);
|
||||||
@@ -230,7 +230,7 @@ describe('IdeClient', () => {
|
|||||||
await ideClient.connect();
|
await ideClient.connect();
|
||||||
|
|
||||||
expect(StreamableHTTPClientTransport).toHaveBeenCalledWith(
|
expect(StreamableHTTPClientTransport).toHaveBeenCalledWith(
|
||||||
new URL('http://localhost:8080/mcp'),
|
new URL('http://127.0.0.1:8080/mcp'),
|
||||||
expect.any(Object),
|
expect.any(Object),
|
||||||
);
|
);
|
||||||
expect(ideClient.getConnectionStatus().status).toBe(
|
expect(ideClient.getConnectionStatus().status).toBe(
|
||||||
@@ -665,7 +665,7 @@ describe('IdeClient', () => {
|
|||||||
await ideClient.connect();
|
await ideClient.connect();
|
||||||
|
|
||||||
expect(StreamableHTTPClientTransport).toHaveBeenCalledWith(
|
expect(StreamableHTTPClientTransport).toHaveBeenCalledWith(
|
||||||
new URL('http://localhost:8080/mcp'),
|
new URL('http://127.0.0.1:8080/mcp'),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
requestInit: {
|
requestInit: {
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -667,10 +667,10 @@ export class IdeClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private createProxyAwareFetch() {
|
private createProxyAwareFetch() {
|
||||||
// ignore proxy for 'localhost' by deafult to allow connecting to the ide mcp server
|
// ignore proxy for '127.0.0.1' by deafult to allow connecting to the ide mcp server
|
||||||
const existingNoProxy = process.env['NO_PROXY'] || '';
|
const existingNoProxy = process.env['NO_PROXY'] || '';
|
||||||
const agent = new EnvHttpProxyAgent({
|
const agent = new EnvHttpProxyAgent({
|
||||||
noProxy: [existingNoProxy, 'localhost'].filter(Boolean).join(','),
|
noProxy: [existingNoProxy, '127.0.0.1'].filter(Boolean).join(','),
|
||||||
});
|
});
|
||||||
const undiciPromise = import('undici');
|
const undiciPromise = import('undici');
|
||||||
return async (url: string | URL, init?: RequestInit): Promise<Response> => {
|
return async (url: string | URL, init?: RequestInit): Promise<Response> => {
|
||||||
@@ -851,5 +851,5 @@ export class IdeClient {
|
|||||||
function getIdeServerHost() {
|
function getIdeServerHost() {
|
||||||
const isInContainer =
|
const isInContainer =
|
||||||
fs.existsSync('/.dockerenv') || fs.existsSync('/run/.containerenv');
|
fs.existsSync('/.dockerenv') || fs.existsSync('/run/.containerenv');
|
||||||
return isInContainer ? 'host.docker.internal' : 'localhost';
|
return isInContainer ? 'host.docker.internal' : '127.0.0.1';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user