MCPcopy Create free account
hub / github.com/Rfym21/Qwen2API / readResponseBody

Method readResponseBody

src/utils/cli.manager.js:43–60  ·  view source on GitHub ↗

* 读取响应体 * @param {Response} response - Fetch 响应对象 * @returns {Promise<*>} 响应体

(response)

Source from the content-addressed store, hash-verified

41 * @returns {Promise<*>} 响应体
42 */
43 async readResponseBody(response) {
44 const contentType = response.headers.get('content-type') || ''
45 const rawText = await response.text()
46
47 if (!rawText) {
48 return ''
49 }
50
51 if (contentType.includes('application/json')) {
52 try {
53 return JSON.parse(rawText)
54 } catch (error) {
55 return rawText
56 }
57 }
58
59 return rawText
60 }
61
62 /**
63 * 启动 OAuth 设备授权流程

Callers 3

initiateDeviceFlowMethod · 0.95
authorizeLoginMethod · 0.95
pollForTokenMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected