Skip to content

Commit

Permalink
feat(core): add app version to request header
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmFly committed Dec 11, 2024
1 parent eee0ed4 commit 4d8abc4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/common/nbstore/src/impls/cloud/blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ 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' }
{
cache: 'default',
headers: {
'x-affine-version': BUILD_CONFIG.appVersion,
},
}
);

if (!res.ok) {
Expand Down
4 changes: 4 additions & 0 deletions packages/frontend/core/src/modules/cloud/services/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4d8abc4

Please sign in to comment.