MCPcopy Index your code
hub / github.com/dataease/SQLBot / http_http

Function http_http

frontend/public/swagger-ui-bundle.js:41726–41759  ·  view source on GitHub ↗
(s, o = {})

Source from the content-addressed store, hash-verified

41724 return a
41725 })
41726 }
41727 async function http_http(s, o = {}) {
41728 ;('object' == typeof s && (s = (o = s).url),
41729 (o.headers = o.headers || {}),
41730 (o = serializeRequest(o)).headers &&
41731 Object.keys(o.headers).forEach((s) => {
41732 const i = o.headers[s]
41733 'string' == typeof i && (o.headers[s] = i.replace(/\n+/g, ' '))
41734 }),
41735 o.requestInterceptor && (o = (await o.requestInterceptor(o)) || o))
41736 const i = o.headers['content-type'] || o.headers['Content-Type']
41737 let a
41738 ;/multipart\/form-data/i.test(i) &&
41739 (delete o.headers['content-type'], delete o.headers['Content-Type'])
41740 try {
41741 ;((a = await (o.userFetch || fetch)(o.url, o)),
41742 (a = await serializeResponse(a, s, o)),
41743 o.responseInterceptor && (a = (await o.responseInterceptor(a)) || a))
41744 } catch (s) {
41745 if (!a) throw s
41746 const o = new Error(a.statusText || `response status is ${a.status}`)
41747 throw ((o.status = a.status), (o.statusCode = a.status), (o.responseError = s), o)
41748 }
41749 if (!a.ok) {
41750 const s = new Error(a.statusText || `response status is ${a.status}`)
41751 // if (a.status === 401 && a.statusText === 'Unauthorized') {
41752 if (a.status === 401) {
41753 location.href =
41754 location.pathname.replace('/docs', '/') + '#/401?title=unauthorized&target=docs'
41755 return a
41756 }
41757 throw ((s.status = a.status), (s.statusCode = a.status), (s.response = a), s)
41758 }
41759 return a
41760 }
41761 const options_retrievalURI = (s) => {
41762 var o, i

Callers

nothing calls this directly

Calls 5

serializeRequestFunction · 0.85
serializeResponseFunction · 0.85
replaceMethod · 0.80
forEachMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected