MCPcopy
hub / github.com/volcengine/OpenViking / readRequestHeader

Function readRequestHeader

web-studio/src/lib/ov-client/client.test.ts:7–21  ·  view source on GitHub ↗
(config: AxiosRequestConfig, name: string)

Source from the content-addressed store, hash-verified

5import { createOvClient } from './client'
6
7function readRequestHeader(config: AxiosRequestConfig, name: string): string {
8 const headers = config.headers as
9 | { get?: (headerName: string) => unknown }
10 | Record<string, unknown>
11 | undefined
12 if (!headers) {
13 return ''
14 }
15 if ('get' in headers && typeof headers.get === 'function') {
16 const value = headers.get(name)
17 return typeof value === 'string' ? value : ''
18 }
19 const value = headers[name] ?? headers[name.toLowerCase()]
20 return typeof value === 'string' ? value : ''
21}
22
23function createRecordingClient() {
24 const requests: AxiosRequestConfig[] = []

Callers 1

client.test.tsFile · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected