Skip to content

Commit

Permalink
specify response type
Browse files Browse the repository at this point in the history
  • Loading branch information
pompurin404 committed Oct 28, 2024
1 parent 35d2a10 commit 23e773d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/main/config/override.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export async function createOverride(item: Partial<IOverrideItem>): Promise<IOve
protocol: 'http',
host: '127.0.0.1',
port: mixedPort
}
},
responseType: 'text'
})
const data = res.data
await setOverride(id, newItem.ext, data)
Expand Down
6 changes: 4 additions & 2 deletions src/main/config/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ export async function createProfile(item: Partial<IProfileItem>): Promise<IProfi
res = await axios.get(urlObj.toString(), {
headers: {
'User-Agent': userAgent || 'clash.meta'
}
},
responseType: 'text'
})
} else {
res = await axios.get(item.url, {
Expand All @@ -145,7 +146,8 @@ export async function createProfile(item: Partial<IProfileItem>): Promise<IProfi
: false,
headers: {
'User-Agent': userAgent || 'clash.meta'
}
},
responseType: 'text'
})
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/core/subStoreApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { getAppConfig } from '../config'
export async function subStoreSubs(): Promise<ISubStoreSub[]> {
const { useCustomSubStore = false, customSubStoreUrl = '' } = await getAppConfig()
const baseUrl = useCustomSubStore ? customSubStoreUrl : `http://127.0.0.1:${subStorePort}`
const res = await axios.get(`${baseUrl}/api/subs`)
const res = await axios.get(`${baseUrl}/api/subs`, { responseType: 'json' })
return res.data.data as ISubStoreSub[]
}

export async function subStoreCollections(): Promise<ISubStoreSub[]> {
const { useCustomSubStore = false, customSubStoreUrl = '' } = await getAppConfig()
const baseUrl = useCustomSubStore ? customSubStoreUrl : `http://127.0.0.1:${subStorePort}`
const res = await axios.get(`${baseUrl}/api/collections`)
const res = await axios.get(`${baseUrl}/api/collections`, { responseType: 'json' })
return res.data.data as ISubStoreSub[]
}
3 changes: 2 additions & 1 deletion src/main/resolve/autoUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export async function checkUpdate(): Promise<IAppVersion | undefined> {
protocol: 'http',
host: '127.0.0.1',
port: mixedPort
}
},
responseType: 'text'
}
)
const latest = yaml.parse(res.data, { merge: true }) as IAppVersion
Expand Down
3 changes: 2 additions & 1 deletion src/main/resolve/gistApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ async function listGists(token: string): Promise<GistInfo[]> {
protocol: 'http',
host: '127.0.0.1',
port
}
},
responseType: 'json'
})
return res.data as GistInfo[]
}
Expand Down

0 comments on commit 23e773d

Please sign in to comment.