Add all arm request related files to Matser (#373)

* “minor changes”
* 'changes for unit test'
This commit is contained in:
Chris-MS-896
2021-01-08 21:56:29 -06:00
committed by GitHub
parent 983c9201bb
commit a4a367a212
3 changed files with 55 additions and 1 deletions

View File

@@ -30,7 +30,7 @@ export class ARMError extends Error {
Object.setPrototypeOf(this, ARMError.prototype);
}
public code: string | number;
public code?: string | number;
}
interface ARMQueryParams {
@@ -63,6 +63,10 @@ export async function armRequest<T>({
queryParams.metricNames && url.searchParams.append("metricnames", queryParams.metricNames);
}
if (!userContext.authorizationToken) {
throw new Error("No authority token provided");
}
const response = await window.fetch(url.href, {
method,
headers: {
@@ -98,6 +102,10 @@ export async function armRequest<T>({
}
async function getOperationStatus(operationStatusUrl: string) {
if (!userContext.authorizationToken) {
throw new Error("No authority token provided");
}
const response = await window.fetch(operationStatusUrl, {
headers: {
Authorization: userContext.authorizationToken