mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
feat(mcp-client): Handle 401 error for httpUrl (#6640)
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
isEnabled,
|
||||
hasValidTypes,
|
||||
McpClient,
|
||||
hasNetworkTransport,
|
||||
} from './mcp-client.js';
|
||||
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
|
||||
import * as SdkClientStdioLib from '@modelcontextprotocol/sdk/client/stdio.js';
|
||||
@@ -566,4 +567,34 @@ describe('mcp-client', () => {
|
||||
expect(hasValidTypes(schema)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('hasNetworkTransport', () => {
|
||||
it('should return true if only url is provided', () => {
|
||||
const config = { url: 'http://example.com' };
|
||||
expect(hasNetworkTransport(config)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return true if only httpUrl is provided', () => {
|
||||
const config = { httpUrl: 'http://example.com' };
|
||||
expect(hasNetworkTransport(config)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return true if both url and httpUrl are provided', () => {
|
||||
const config = {
|
||||
url: 'http://example.com/sse',
|
||||
httpUrl: 'http://example.com/http',
|
||||
};
|
||||
expect(hasNetworkTransport(config)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false if neither url nor httpUrl is provided', () => {
|
||||
const config = { command: 'do-something' };
|
||||
expect(hasNetworkTransport(config)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for an empty config object', () => {
|
||||
const config = {};
|
||||
expect(hasNetworkTransport(config)).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user