Added nodeinfo content length limit (5k) solving issues with global redirects to endless streams

main
Štěpán Škorpil 2022-04-18 22:09:24 +02:00
rodzic 3ed37c04ce
commit cc42eebe0e
1 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -24,9 +24,12 @@ const schema = z.object({
export type NodeInfo = z.infer<typeof schema>
export const retrieveNodeInfo = async (url:string):Promise<NodeInfo> => {
export const retrieveNodeInfo = async (url: string): Promise<NodeInfo> => {
console.info('Retrieving node info', { url: url })
const nodeInfoResponse = await axios.get(url, { timeout: getDefaultTimeoutMilliseconds() })
const nodeInfoResponse = await axios.get(url, {
timeout: getDefaultTimeoutMilliseconds(),
maxContentLength: 5000
})
assertSuccessJsonResponse(nodeInfoResponse)
return schema.parse(nodeInfoResponse.data)
}