Skip to content

Commit 412d60c

Browse files
authored
added timestamp to requests (#25)
1 parent df0be20 commit 412d60c

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@crowdin/ota-client",
3-
"version": "0.3.2",
3+
"version": "0.4.0",
44
"description": "JavaScript library for Crowdin OTA Content Delivery",
55
"main": "out/index.js",
66
"types": "out/index.d.ts",

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ export default class OtaClient {
209209
} else {
210210
url += `/${language}${file}`;
211211
}
212+
const timestamp = await this.getManifestTimestamp();
213+
url += `?timestamp=${timestamp}`;
212214
return this.httpClient.get(url);
213215
}
214216

tests/index.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ describe('OTA client', () => {
4545
scope = nock(OtaClient.BASE_URL)
4646
.get(`/${hash}/manifest.json`)
4747
.reply(200, manifest)
48-
.get(`/${hash}/content/${languageCode}${filePath}`)
48+
.get(`/${hash}/content/${languageCode}${filePath}?timestamp=${now}`)
4949
.times(3)
5050
.reply(200, fileContent)
5151
.get(`/${hashForStrings}/manifest.json`)
5252
.reply(200, manifestWithJsonFiles)
53-
.get(`/${hashForStrings}/content/${languageCode}${jsonFilePath1}`)
53+
.get(`/${hashForStrings}/content/${languageCode}${jsonFilePath1}?timestamp=${now}`)
5454
.reply(200, jsonFileContent1)
55-
.get(`/${hashForStrings}/content/${languageCode}${jsonFilePath2}`)
55+
.get(`/${hashForStrings}/content/${languageCode}${jsonFilePath2}?timestamp=${now}`)
5656
.reply(200, jsonFileContent2);
5757
});
5858

0 commit comments

Comments
 (0)