mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-04-14 21:58:14 +01:00
add custom header support and fix ui
This commit is contained in:
parent
2a44c619c5
commit
b26420cd85
@ -8,14 +8,14 @@ import { configContext } from "../../../../ConfigContext";
|
||||
import { userContext } from '../../../../UserContext';
|
||||
import { armRequest } from "../../../../Utils/arm/request";
|
||||
import {
|
||||
Authorization,
|
||||
ConnectTerminalResponse,
|
||||
NetworkType,
|
||||
OsType,
|
||||
ProvisionConsoleResponse,
|
||||
SessionType,
|
||||
Settings,
|
||||
ShellType
|
||||
Authorization,
|
||||
ConnectTerminalResponse,
|
||||
NetworkType,
|
||||
OsType,
|
||||
ProvisionConsoleResponse,
|
||||
SessionType,
|
||||
Settings,
|
||||
ShellType
|
||||
} from "../Models/DataModels";
|
||||
import { getLocale } from '../Utils/CommonUtils';
|
||||
|
||||
|
@ -29,6 +29,7 @@ export class AttachAddon implements ITerminalAddon {
|
||||
this._endMarker = options?.endMarker;
|
||||
this._terminalSuppressedData = options?.terminalSuppressedData;
|
||||
this._socketData = '';
|
||||
this._flag = true;
|
||||
}
|
||||
|
||||
public activate(terminal: Terminal): void {
|
||||
|
@ -47,6 +47,7 @@ interface Options {
|
||||
body?: unknown;
|
||||
queryParams?: ARMQueryParams;
|
||||
contentType?: string;
|
||||
customHeaders?: Record<string, string>;
|
||||
}
|
||||
|
||||
export async function armRequestWithoutPolling<T>({
|
||||
@ -57,6 +58,7 @@ export async function armRequestWithoutPolling<T>({
|
||||
body: requestBody,
|
||||
queryParams,
|
||||
contentType,
|
||||
customHeaders
|
||||
}: Options): Promise<{ result: T; operationStatusUrl: string }> {
|
||||
const url = new URL(path, host);
|
||||
url.searchParams.append("api-version", configContext.armAPIVersion || apiVersion);
|
||||
@ -65,7 +67,7 @@ export async function armRequestWithoutPolling<T>({
|
||||
queryParams.metricNames && url.searchParams.append("metricnames", queryParams.metricNames);
|
||||
}
|
||||
|
||||
if (!userContext.authorizationToken) {
|
||||
if (!userContext.authorizationToken && !customHeaders["Authorization"]) {
|
||||
throw new Error("No authority token provided");
|
||||
}
|
||||
|
||||
@ -74,6 +76,7 @@ export async function armRequestWithoutPolling<T>({
|
||||
headers: {
|
||||
Authorization: userContext.authorizationToken,
|
||||
[HttpHeaders.contentType]: contentType || "application/json",
|
||||
...customHeaders
|
||||
},
|
||||
body: requestBody ? JSON.stringify(requestBody) : undefined,
|
||||
});
|
||||
@ -109,6 +112,7 @@ export async function armRequest<T>({
|
||||
body: requestBody,
|
||||
queryParams,
|
||||
contentType,
|
||||
customHeaders
|
||||
}: Options): Promise<T> {
|
||||
const armRequestResult = await armRequestWithoutPolling<T>({
|
||||
host,
|
||||
@ -118,6 +122,7 @@ export async function armRequest<T>({
|
||||
body: requestBody,
|
||||
queryParams,
|
||||
contentType,
|
||||
customHeaders
|
||||
});
|
||||
const operationStatusUrl = armRequestResult.operationStatusUrl;
|
||||
if (operationStatusUrl) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user