@@ -60,6 +60,7 @@ import { AIConfigurationTracingOptions } from "./requestTracing/aiConfigurationT
6060import { KeyFilter , LabelFilter , SettingWatcher , SettingSelector , PagedSettingsWatcher , WatchedSetting } from "./types.js" ;
6161import { ConfigurationClientManager } from "./configurationClientManager.js" ;
6262import { getFixedBackoffDuration , getExponentialBackoffDuration } from "./common/backoffUtils.js" ;
63+ import { getStatusCode } from "./common/utils.js" ;
6364import { InvalidOperationError , ArgumentError , isFailoverableError , isInputError , SnapshotReferenceError } from "./common/errors.js" ;
6465import { ErrorMessages } from "./common/errorMessages.js" ;
6566
@@ -654,7 +655,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
654655
655656 const watcher : SettingWatcher = this . #sentinels. get ( watchedSetting ) ! ; // watcher should always exist for sentinels
656657 const isDeleted = response === undefined && watcher . etag !== undefined ; // previously existed, now deleted
657- const isChanged = response && Number ( response . statusCode ) === 200 && watcher . etag !== response . etag ; // etag changed
658+ const isChanged = response && getStatusCode ( response . statusCode ) === 200 && watcher . etag !== response . etag ; // etag changed
658659 if ( isDeleted || isChanged ) {
659660 changedSentinel = watchedSetting ;
660661 changedSentinelWatcher = { etag : isChanged ? response . etag : undefined } ;
@@ -752,7 +753,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
752753
753754 for await ( const page of pageIterator ) {
754755 // when conditional request is sent, the response will be 304 if not changed
755- if ( Number ( page . _response . status ) === 200 ) { // created or changed
756+ if ( getStatusCode ( page . _response . status ) === 200 ) { // created or changed
756757 return true ;
757758 }
758759 }
@@ -781,7 +782,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
781782 try {
782783 response = await this . #executeWithFailoverPolicy( funcToExecute ) ;
783784 } catch ( error ) {
784- if ( isRestError ( error ) && Number ( error . statusCode ) === 404 ) {
785+ if ( isRestError ( error ) && getStatusCode ( error . statusCode ) === 404 ) {
785786 response = undefined ;
786787 } else {
787788 throw error ;
@@ -824,7 +825,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
824825 try {
825826 response = await this . #executeWithFailoverPolicy( funcToExecute ) ;
826827 } catch ( error ) {
827- if ( isRestError ( error ) && Number ( error . statusCode ) === 404 ) {
828+ if ( isRestError ( error ) && getStatusCode ( error . statusCode ) === 404 ) {
828829 response = undefined ;
829830 } else {
830831 throw error ;
0 commit comments