MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / resetMethods

Method resetMethods

frontend/packages/common/src/utils/curl.ts:140–152  ·  view source on GitHub ↗

* 重置 methods, 由于像浏览器里中复制的 curl 字符串,可能不会存在 -X 或者 --request 参数,导致无法获取到 method 所以这里只能根据上下文推断

()

Source from the content-addressed store, hash-verified

138 * 重置 methods, 由于像浏览器里中复制的 curl 字符串,可能不会存在 -X 或者 --request 参数,导致无法获取到 method 所以这里只能根据上下文推断
139 */
140 resetMethods() {
141 // 如果已经获取到 method 不需要再推断
142 if (this.parseObj.method) {
143 return
144 }
145 if (this.parseObj.body) {
146 // 存在请求参数推断为 post 请求
147 this.parseObj.method = 'POST'
148 return
149 }
150 // 默认为 GET
151 this.parseObj.method = 'GET'
152 }
153 parseCurl() {
154 const result = this.parseObj
155 // 零宽空格(zero-width space) 需要去除掉

Callers 1

constructorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected