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

Function buildRequest

frontend/public/swagger-ui-bundle.js:55918–56046  ·  view source on GitHub ↗
(s, o)

Source from the content-addressed store, hash-verified

55916 : window,
55917 { btoa: Gx } = Kx,
55918 Yx = Gx
55919 function buildRequest(s, o) {
55920 const {
55921 operation: i,
55922 requestBody: a,
55923 securities: u,
55924 spec: _,
55925 attachContentTypeForEmptyPayload: w,
55926 } = s
55927 let { requestContentType: x } = s
55928 o = (function applySecurities({
55929 request: s,
55930 securities: o = {},
55931 operation: i = {},
55932 spec: a,
55933 }) {
55934 var u
55935 const _ = { ...s },
55936 { authorized: w = {} } = o,
55937 x = i.security || a.security || [],
55938 C = w && !!Object.keys(w).length,
55939 j =
55940 (null == a || null === (u = a.components) || void 0 === u
55941 ? void 0
55942 : u.securitySchemes) || {}
55943 if (
55944 ((_.headers = _.headers || {}),
55945 (_.query = _.query || {}),
55946 !Object.keys(o).length ||
55947 !C ||
55948 !x ||
55949 (Array.isArray(i.security) && !i.security.length))
55950 )
55951 return s
55952 return (
55953 x.forEach((s) => {
55954 Object.keys(s).forEach((s) => {
55955 const o = w[s],
55956 i = j[s]
55957 if (!o) return
55958 const a = o.value || o,
55959 { type: u } = i
55960 if (o)
55961 if ('apiKey' === u)
55962 ('query' === i.in && (_.query[i.name] = a),
55963 'header' === i.in && (_.headers[i.name] = a),
55964 'cookie' === i.in && (_.cookies[i.name] = a))
55965 else if ('http' === u) {
55966 if (/^basic$/i.test(i.scheme)) {
55967 const s = a.username || '',
55968 o = a.password || '',
55969 i = Yx(`${s}:${o}`)
55970 _.headers.Authorization = `Basic ${i}`
55971 }
55972 ;/^bearer$/i.test(i.scheme) && (_.headers.Authorization = `Bearer ${a}`)
55973 } else if ('oauth2' === u || 'openIdConnect' === u) {
55974 const s = o.token || {},
55975 a = s[i['x-tokenName'] || 'access_token']

Callers 1

execute_buildRequestFunction · 0.85

Calls 9

YxFunction · 0.85
fuFunction · 0.85
concatMethod · 0.80
keysMethod · 0.45
isArrayMethod · 0.45
forEachMethod · 0.45
reduceMethod · 0.45
filterMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected