feat(core): add app version to request header (#9101)

This commit is contained in:
JimmFly
2024-12-19 02:38:08 +00:00
parent 70deeaa804
commit a153a1c3c9
2 changed files with 9 additions and 1 deletions

View File

@@ -16,7 +16,11 @@ export class CloudBlobStorage extends BlobStorage {
override async get(key: string) {
const res = await fetch(
this.options.peer + '/api/workspaces/' + this.spaceId + '/blobs/' + key,
{ cache: 'default' }
{
headers: {
'x-affine-version': BUILD_CONFIG.appVersion,
},
}
);
if (!res.ok) {

View File

@@ -54,6 +54,10 @@ export class FetchService extends Service {
.fetch(new URL(input, this.serverService.server.serverMetadata.baseUrl), {
...init,
signal: abortController.signal,
headers: {
...init?.headers,
'x-affine-version': BUILD_CONFIG.appVersion,
},
})
.catch(err => {
logger.debug('network error', err);