瀏覽代碼

adeed headers

Viktoriia 1 年之前
父節點
當前提交
f9b95e6db8
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      src/utils/determineServer.ts

+ 8 - 2
src/utils/determineServer.ts

@@ -1,5 +1,6 @@
 import axios from 'axios';
-import { API_URL } from 'src/constants';
+import { Platform } from 'react-native';
+import { API_URL, APP_VERSION } from 'src/constants';
 import { API } from 'src/types';
 
 const SERVER_LIST_URL = API_URL + '/' + API.GET_SERVERS;
@@ -23,7 +24,12 @@ const testServerSpeed = async (serverUrl: string) => {
 
 export const determineFastestServer = async () => {
   try {
-    const response = await axios.get(SERVER_LIST_URL);
+    const response = await axios.get(SERVER_LIST_URL, {
+      headers: {
+        'App-Version': APP_VERSION,
+        'Platform': Platform.OS
+      }
+    });
     const servers = response.data?.maps;
 
     const speedTests = await Promise.allSettled(