Skip to content

Commit

Permalink
core: Send hardcoded User-Agent header in requests
Browse files Browse the repository at this point in the history
This is required for the server to automatically mark
sent messages as read. See `sent_by_human` in
`zulip/zerver/models.py`.

Fixes: zulip#440
  • Loading branch information
sirpengi committed Dec 13, 2023
1 parent c06855e commit 431015a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/api/core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ class ApiConnection {
}
}

void addUserAgent(http.BaseRequest request) {
request.headers['User-Agent'] = 'ZulipMobile/?.?.? (Android 14)';
}

final http.Client _client;

bool _isOpen = true;
Expand All @@ -80,6 +84,7 @@ class ApiConnection {
assert(debugLog("${request.method} ${request.url}"));

addAuth(request);
addUserAgent(request);

final http.StreamedResponse response;
try {
Expand Down

0 comments on commit 431015a

Please sign in to comment.