mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 15:06:55 +00:00
Add correct content-type header to terminals calls (#258)
This commit is contained in:
parent
0cc38868a6
commit
c08a1872cc
@ -7,7 +7,7 @@ import { JupyterLabAppFactory } from "./JupyterLabAppFactory";
|
|||||||
import { Action } from "../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { updateUserContext } from "../UserContext";
|
import { updateUserContext } from "../UserContext";
|
||||||
import { TerminalQueryParams } from "../Common/Constants";
|
import { HttpHeaders, TerminalQueryParams } from "../Common/Constants";
|
||||||
|
|
||||||
const getUrlVars = (): { [key: string]: string } => {
|
const getUrlVars = (): { [key: string]: string } => {
|
||||||
const vars: { [key: string]: string } = {};
|
const vars: { [key: string]: string } = {};
|
||||||
@ -20,16 +20,20 @@ const getUrlVars = (): { [key: string]: string } => {
|
|||||||
|
|
||||||
const createServerSettings = (urlVars: { [key: string]: string }): ServerConnection.ISettings => {
|
const createServerSettings = (urlVars: { [key: string]: string }): ServerConnection.ISettings => {
|
||||||
let body: BodyInit;
|
let body: BodyInit;
|
||||||
|
let headers: HeadersInit;
|
||||||
if (urlVars.hasOwnProperty(TerminalQueryParams.TerminalEndpoint)) {
|
if (urlVars.hasOwnProperty(TerminalQueryParams.TerminalEndpoint)) {
|
||||||
body = JSON.stringify({
|
body = JSON.stringify({
|
||||||
endpoint: urlVars[TerminalQueryParams.TerminalEndpoint]
|
endpoint: urlVars[TerminalQueryParams.TerminalEndpoint]
|
||||||
});
|
});
|
||||||
|
headers = {
|
||||||
|
[HttpHeaders.contentType]: "application/json"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const server = urlVars[TerminalQueryParams.Server];
|
const server = urlVars[TerminalQueryParams.Server];
|
||||||
let options: Partial<ServerConnection.ISettings> = {
|
let options: Partial<ServerConnection.ISettings> = {
|
||||||
baseUrl: server,
|
baseUrl: server,
|
||||||
init: { body },
|
init: { body, headers },
|
||||||
fetch: window.parent.fetch
|
fetch: window.parent.fetch
|
||||||
};
|
};
|
||||||
if (urlVars.hasOwnProperty(TerminalQueryParams.Token)) {
|
if (urlVars.hasOwnProperty(TerminalQueryParams.Token)) {
|
||||||
@ -37,7 +41,7 @@ const createServerSettings = (urlVars: { [key: string]: string }): ServerConnect
|
|||||||
baseUrl: server,
|
baseUrl: server,
|
||||||
token: urlVars[TerminalQueryParams.Token],
|
token: urlVars[TerminalQueryParams.Token],
|
||||||
appendToken: true,
|
appendToken: true,
|
||||||
init: { body },
|
init: { body, headers },
|
||||||
fetch: window.parent.fetch
|
fetch: window.parent.fetch
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user