You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cached AJAX responses lose status metadata exposed through vm.route.response #2812
The first AJAX request calls the success callback with (content, options, responseStatus), but a cache hit calls it with only (content, options). Fetch's contentFetched handler assigns that third argument to vm.route.response, so revisiting a cached page loses the response status available on the first visit.
On develop f34374b7423340e5ddec81c8ff565c26cc056fb5, a regression using the existing xhr-mock dependency shows:
get('/page.md').then((content,options,response)=>{// First request: response is { ok: true, status: 200, statusText: 'OK' }get('/page.md').then((cachedContent,cachedOptions,cachedResponse)=>{// cachedResponse is undefined});});
Expected behavior
Cached content should carry the original response metadata too. Plugins should be able to inspect vm.route.response consistently across initial loads and revisits without adding cache-specific workarounds.
Suggested fix
Store the response status alongside the cached content and options, and pass all three to the callback on cache hits. This preserves the actual response status rather than synthesizing a 200 response.
Environment
Docsify 5.0.0 develop source, Jest/JSDOM on macOS. Reproduced with an HTTP response mock at the XMLHttpRequest boundary.
Activity