MCPcopy Create free account
hub / github.com/emwalker/digraph / onProxyReq

Function onProxyReq

client/src/server/configureApiProxy.ts:24–34  ·  view source on GitHub ↗
(proxyReq, req: IGetUserAuthInfoRequest)

Source from the content-addressed store, hash-verified

22 changeOrigin: true,
23 secure: false,
24 onProxyReq(proxyReq, req: IGetUserAuthInfoRequest) {
25 const { user } = req
26
27 if (user && user.id && user.sessionId) {
28 const { id, sessionId } = user
29 const secret = basicAuthSecret(id, sessionId)
30 proxyReq.setHeader('Authorization', `Basic ${secret}`)
31 } else {
32 console.log('no user found with the request, omitting basic auth header')
33 }
34 },
35 onError(err) {
36 console.log('problem proxying request to api server:', err)
37 },

Callers

nothing calls this directly

Calls 1

basicAuthSecretFunction · 0.85

Tested by

no test coverage detected