-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable api calls #851
base: master
Are you sure you want to change the base?
Disable api calls #851
Conversation
|
||
constructor(expectedStatusCode?: number) { | ||
this.expectedStatusCode = expectedStatusCode; | ||
} | ||
public request(verb: acquisitionSdk.Http.Verb, url: string, requestBodyOrCallback: string | acquisitionSdk.Callback<acquisitionSdk.Http.Response>, callback?: acquisitionSdk.Callback<acquisitionSdk.Http.Response>): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add empty line
reportStatusDownloadUrl = serverUrl + publicPrefixUrl + "/report_status/download"; | ||
updateCheckUrl = serverUrl + publicPrefixUrl + "/update_check?"; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove one empty line
src/test/acquisition-rest-mock.ts
Outdated
public request(verb: acquisitionSdk.Http.Verb, url: string, requestBodyOrCallback: string | acquisitionSdk.Callback<acquisitionSdk.Http.Response>, callback?: acquisitionSdk.Callback<acquisitionSdk.Http.Response>): void { | ||
if (!callback && typeof requestBodyOrCallback === "function") { | ||
callback = <acquisitionSdk.Callback<acquisitionSdk.Http.Response>>requestBodyOrCallback; | ||
} | ||
|
||
if (verb === acquisitionSdk.Http.Verb.GET && url.indexOf(updateCheckUrl) === 0) { | ||
var params = querystring.parse(url.substring(updateCheckUrl.length)); | ||
Server.onUpdateCheck(params, callback); | ||
Server.onUpdateCheck(params, callback,this.expectedStatusCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space between parameters
@@ -226,6 +229,67 @@ describe("Acquisition SDK", () => { | |||
done(); | |||
})); | |||
}); | |||
it("disables api calls on unsuccessful response", (done: Mocha.Done): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add empty line
src/test/acquisition-sdk.ts
Outdated
assert.strictEqual(returnPackage, null); | ||
acquisition = new acquisitionSdk.AcquisitionManager(new mockApi.HttpRequester(404), configuration); | ||
(acquisitionSdk.AcquisitionManager as any)._apiCallsDisabled = false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty line
|
||
done(); | ||
}) | ||
it("doesn't disable api calls on successful response", (done: Mocha.Done): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add empty line
I've built and tested this PR on my machine. Everything seems fine. |
Description
Implemented feature for stopping api calls from being sent after unsuccessful response. This behavior is aligned with other appcenter SDKs. Disabling of api calls occurs only per session after first failed request.
Related PRs or issues
AB#107980