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

Function authorizeRequest

frontend/public/swagger-ui-bundle.js:31776–31844  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

31774 },
31775 authorizeRequest =
31776 (s) =>
31777 ({
31778 fn: o,
31779 getConfigs: i,
31780 authActions: a,
31781 errActions: u,
31782 oas3Selectors: _,
31783 specSelectors: w,
31784 authSelectors: x,
31785 }) => {
31786 let C,
31787 { body: j, query: L = {}, headers: B = {}, name: $, url: U, auth: V } = s,
31788 { additionalQueryStringParams: z } = x.getConfigs() || {}
31789 if (w.isOAS3()) {
31790 let s = _.serverEffectiveValue(_.selectedServer())
31791 C = Nt()(U, s, !0)
31792 } else C = Nt()(U, w.url(), !0)
31793 'object' == typeof z && (C.query = Object.assign({}, C.query, z))
31794 const Y = C.toString()
31795 let Z = Object.assign(
31796 {
31797 Accept: 'application/json, text/plain, */*',
31798 'Content-Type': 'application/x-www-form-urlencoded',
31799 'X-Requested-With': 'XMLHttpRequest',
31800 },
31801 B
31802 )
31803 o.fetch({
31804 url: Y,
31805 method: 'post',
31806 headers: Z,
31807 query: L,
31808 body: j,
31809 requestInterceptor: i().requestInterceptor,
31810 responseInterceptor: i().responseInterceptor,
31811 })
31812 .then(function (s) {
31813 let o = JSON.parse(s.data),
31814 i = o && (o.error || ''),
31815 _ = o && (o.parseError || '')
31816 s.ok
31817 ? i || _
31818 ? u.newAuthErr({
31819 authId: $,
31820 level: 'error',
31821 source: 'auth',
31822 message: JSON.stringify(o),
31823 })
31824 : a.authorizeOauth2WithPersistOption({ auth: V, token: o })
31825 : u.newAuthErr({
31826 authId: $,
31827 level: 'error',
31828 source: 'auth',
31829 message: s.statusText,
31830 })
31831 })
31832 .catch((s) => {
31833 let o = new Error(s).message

Callers

nothing calls this directly

Calls 7

getConfigsMethod · 0.80
iFunction · 0.70
NtFunction · 0.50
urlMethod · 0.45
toStringMethod · 0.45
thenMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected