mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-28 07:40:30 -04:00
Finish up no-unsafe-assignment fixes in azurecore (#22836)
* Finish up no-unsafe-assignment fixes in azurecore * Add link to typings * Remove unused * Ignore webpack file
This commit is contained in:
@@ -29,6 +29,7 @@ import { HttpClient } from './httpClient';
|
||||
import { getProxyEnabledHttpClient, getTenantIgnoreList, updateTenantIgnoreList } from '../../utils';
|
||||
import { errorToPromptFailedResult } from './networkUtils';
|
||||
import { MsalCachePluginProvider } from '../utils/msalCachePlugin';
|
||||
import { AzureListOperationResponse, ErrorResponseBodyWithError, isErrorResponseBody as isErrorResponseBodyWithError } from '../../azureResource/utils';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export abstract class AzureAuth implements vscode.Disposable {
|
||||
@@ -482,7 +483,7 @@ export abstract class AzureAuth implements vscode.Disposable {
|
||||
Logger.verbose(`Fetching tenants with uri: ${tenantUri}`);
|
||||
let tenantList: string[] = [];
|
||||
|
||||
const tenantResponse = await this.httpClient.sendGetRequestAsync<any>(tenantUri, {
|
||||
const tenantResponse = await this.httpClient.sendGetRequestAsync<AzureListOperationResponse<TenantResponse[]> | ErrorResponseBodyWithError>(tenantUri, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
@@ -490,9 +491,9 @@ export abstract class AzureAuth implements vscode.Disposable {
|
||||
});
|
||||
|
||||
const data = tenantResponse.data;
|
||||
if (data.error) {
|
||||
Logger.error(`Error fetching tenants :${data.error.code} - ${data.error.message}`);
|
||||
throw new Error(`${data.error.code} - ${data.error.message}`);
|
||||
if (isErrorResponseBodyWithError(data)) {
|
||||
Logger.error(`Error fetching tenants :${data.error?.code} - ${data.error?.message}`);
|
||||
throw new Error(`${data.error?.code} - ${data.error?.message}`);
|
||||
}
|
||||
const tenants: Tenant[] = data.value.map((tenantInfo: TenantResponse) => {
|
||||
if (tenantInfo.displayName) {
|
||||
|
||||
@@ -233,10 +233,14 @@ const networkRequestViaProxy = <T>(
|
||||
|
||||
// check if the value of the header is supposed to be a JSON object
|
||||
try {
|
||||
// TODO: Investigate this - https://github.com/microsoft/azuredatastudio/issues/22835
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const object = JSON.parse(headerValue);
|
||||
|
||||
// if it is, then convert it from a string to a JSON object
|
||||
if (object && (typeof object === 'object')) {
|
||||
// TODO: Investigate this - https://github.com/microsoft/azuredatastudio/issues/22835
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
headerValue = object;
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user