Skip to content

Commit

Permalink
Pin axios to 1.2.2 (#202)
Browse files Browse the repository at this point in the history
* Pin axios version

* Add a null check and log error

* Pin to exact 1.1.0

* Pin to 1.2.2

* Revert null change
  • Loading branch information
austeja-bentley committed Sep 14, 2023
1 parent 42e9d92 commit d957211
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion clients/imodels-client-management/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"extends": "./node_modules/@itwin/imodels-client-common-config/.eslintrc.json"
},
"dependencies": {
"axios": "^1.0.0"
"axios": "1.2.2"
},
"devDependencies": {
"@itwin/imodels-client-common-config": "workspace:*",
Expand Down
20 changes: 10 additions & 10 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion itwin-platform-access/imodels-access-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@azure/abort-controller": "^1.1.0",
"@itwin/imodels-access-common": "workspace:*",
"@itwin/imodels-client-authoring": "workspace:*",
"axios": "^1.0.0"
"axios": "1.2.2"
},
"devDependencies": {
"@itwin/core-backend": "^4.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
CheckpointArg, CheckpointProps,
V2CheckpointAccessProps
} from "@itwin/core-backend";
import { Logger } from "@itwin/core-bentley";
import { Constants } from "@itwin/imodels-access-common/lib/Constants";
import { handleAPIErrors } from "@itwin/imodels-access-common/lib/ErrorHandlingFunctions";
import axios, { AxiosResponse } from "axios";
Expand Down Expand Up @@ -79,7 +80,12 @@ export async function getV1CheckpointSize(downloadUrl: string): Promise<number>
const contentRangeHeaderName = "content-range";

const response: AxiosResponse = await axios.get(downloadUrl, { headers: { Range: emptyRangeHeaderValue } });
const rangeHeaderValue: string = response.headers[contentRangeHeaderName];
const rangeHeaderValue: string | undefined = response.headers[contentRangeHeaderName];
if (!rangeHeaderValue) {
Logger.logError("BackendIModelsAccess", "Cannot determine total V1 checkpoint size");
return 0;
}

const rangeTotalBytesString: string = rangeHeaderValue.split("/")[1];
const rangeTotalBytes: number = parseInt(rangeTotalBytesString, 10);

Expand Down
2 changes: 1 addition & 1 deletion tests/imodels-clients-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@itwin/imodels-client-test-utils": "workspace:*",
"@itwin/object-storage-azure": "^2.0.0",
"@itwin/object-storage-core": "^2.0.0",
"axios": "^1.0.0",
"axios": "1.2.2",
"chai": "~4.3.4",
"chai-as-promised": "~7.1.1",
"dotenv": "~10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion utils/imodels-client-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@itwin/imodels-client-authoring": "workspace:*",
"@itwin/imodels-client-management": "workspace:*",
"@itwin/object-storage-core": "^2.0.0",
"axios": "^1.0.0",
"axios": "1.2.2",
"chai": "~4.3.4",
"dotenv": "~10.0.0",
"inversify": "~6.0.1",
Expand Down

0 comments on commit d957211

Please sign in to comment.