mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove redundant applyHeaders method (#469)
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
69778d5dcc
commit
c15aa7972c
@ -172,10 +172,6 @@ export class ContextHandler {
|
|||||||
return serverPort
|
return serverPort
|
||||||
}
|
}
|
||||||
|
|
||||||
public applyHeaders(req: http.IncomingMessage) {
|
|
||||||
req.headers["authorization"] = `Bearer ${this.id}`
|
|
||||||
}
|
|
||||||
|
|
||||||
public async withTemporaryKubeconfig(callback: (kubeconfig: string) => Promise<any>) {
|
public async withTemporaryKubeconfig(callback: (kubeconfig: string) => Promise<any>) {
|
||||||
try {
|
try {
|
||||||
await callback(this.cluster.kubeconfigPath())
|
await callback(this.cluster.kubeconfigPath())
|
||||||
|
|||||||
@ -142,13 +142,6 @@ export class LensProxy {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const contextHandler = cluster.contextHandler
|
const contextHandler = cluster.contextHandler
|
||||||
try {
|
|
||||||
contextHandler.applyHeaders(req)
|
|
||||||
} catch (error) {
|
|
||||||
res.statusCode = 503
|
|
||||||
res.end()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
contextHandler.ensureServer().then(async () => {
|
contextHandler.ensureServer().then(async () => {
|
||||||
const proxyTarget = await this.getProxyTarget(req, contextHandler)
|
const proxyTarget = await this.getProxyTarget(req, contextHandler)
|
||||||
if (proxyTarget) {
|
if (proxyTarget) {
|
||||||
@ -161,9 +154,6 @@ export class LensProxy {
|
|||||||
|
|
||||||
protected async handleWsUpgrade(req: http.IncomingMessage, socket: Socket, head: Buffer) {
|
protected async handleWsUpgrade(req: http.IncomingMessage, socket: Socket, head: Buffer) {
|
||||||
const wsServer = this.createWsListener();
|
const wsServer = this.createWsListener();
|
||||||
const cluster = this.clusterManager.getClusterForRequest(req)
|
|
||||||
const contextHandler = cluster.contextHandler
|
|
||||||
contextHandler.applyHeaders(req);
|
|
||||||
wsServer.handleUpgrade(req, socket, head, (con) => {
|
wsServer.handleUpgrade(req, socket, head, (con) => {
|
||||||
wsServer.emit("connection", con, req);
|
wsServer.emit("connection", con, req);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user