【发布时间】:2017-12-01 10:36:38
【问题描述】:
我想为 TTFB 指定一个超时时间(到第一个字节的时间)。
Spec (https://xhr.spec.whatwg.org/#event-xhr-timeout) 说“在获取完成之前作者指定的超时已经过去。”,这不是我想要的。
用例;我可能会从服务器发送媒体,因此响应可能需要任意长的时间才能返回。
但返回 nothing 是一种错误情况,这意味着我想重试请求。
怎么做?
关于超时/ontimeout 的参考:https://stackoverflow.com/a/4958782/63621https://fetch.spec.whatwg.org/#concept-network-error
【问题讨论】: