Hỏi & Đáp
axios timeout
안녕하세요. api 서버를 꺼버리고 테스트 했을때도 timeout 시간동안 계속 시도하는걸로 이해했는데 그게 아니었네요. api 서버에서 의도적으로 11초의 delay를 주니 정상적인 timeout error가 발생한것을 확인했습니다. 빠르고 정확한 답변에 감사드립니다.
- Lượt thích
- 0
- Số bình luận
- 3
- Lượt xem
- 385
Hỏi & Đáp
안녕하세요. api 서버를 꺼버리고 테스트 했을때도 timeout 시간동안 계속 시도하는걸로 이해했는데 그게 아니었네요. api 서버에서 의도적으로 11초의 delay를 주니 정상적인 timeout error가 발생한것을 확인했습니다. 빠르고 정확한 답변에 감사드립니다.
Hỏi & Đáp
안녕하세요. console로 찍어보니 아래와 같습니다. AxiosError { message : 'Network Error' , name : 'AxiosError' , code : 'ERR_NETWORK' , config : {…}, request : XMLHttpRequest, …} code : "ERR_NETWORK" config : adapter : (3) [ 'xhr' , 'http' , 'fetch' ] allowAbsoluteUrls : true baseURL : " http://localhost:58824/api/post " data : undefined env : { FormData : ƒ , Blob : ƒ } headers : AxiosHeaders { Accept : 'application/json, text/plain, / ' , Content-Type : undefined , X-Custom-Header : 'foobar' } maxBodyLength : -1 maxContentLength : -1 method : "get" timeout : 10000 transformRequest : [ ƒ ] transformResponse : [ ƒ ] transitional : { silentJSONParsing : true , forcedJSONParsing : true , clarifyTimeoutError : false } url : "?group=1&page=1" validateStatus : ƒ validateStatus(status) xsrfCookieName : "XSRF-TOKEN" xsrfHeaderName : "X-XSRF-TOKEN" [[Prototype]] : Object message : "Network Error" name : "AxiosError" request : XMLHttpRequest { onreadystatechange : null , readyState : 4 , timeout : 10000 , withCredentials : false , upload : XMLHttpRequestUpload, …} stack : "AxiosError: Network Error\n at XMLHttpRequest.handleError ( http://localhost:3000/node_modules/.vite/deps/axios.js?v=597761da:1542:14)\n at Axios.request ( http://localhost:3000/node_modules/.vite/deps/axios.js?v=597761da:2062:41)\n at async fetchPosts ( http://localhost:3000/src/components/PostListComponent.vue?t=1745193941392:39:22 )" [[Prototype]] : Error