mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-03-21 18:04:10 -05:00
Set event stream reconnect time from Retry-After header
This commit is contained in:
parent
69afbc6d69
commit
2cbfdc5e04
|
|
@ -168,6 +168,12 @@ export default class EventSource {
|
|||
this._response = response;
|
||||
this._connecting = null;
|
||||
|
||||
const retry_after = response.headers.get('Retry-After');
|
||||
|
||||
if (retry_after && /^\d+$/.test(retry_after)) {
|
||||
this._retry_after = parseInt(retry_after);
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
const error = await EventSourceErrorResponse.fromResponse(response, 'Non-200 status code');
|
||||
return this._handleResponseError(response, controller, error);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user