mirror of
https://github.com/4cuck/teapawt.git
synced 2026-10-27 19:04:35 +00:00
scroll: return 204 instead of 404 for empty scroll responses
404 means the resource doesn't exist; 204 (No Content) correctly signals that pagination reached the end. The JS fetch handler now checks for any non-2xx status instead of only 404, so it stops scrolling on 204 too.
This commit is contained in:
1 parent
a7f9a24f29
commit
77c083e013
2 files changed
+2
-2
No files matched your search
@@ -40,7 +40,7 @@ window.onload = function () {
|
||||
url.searchParams.append("scroll", "true");
|
||||
|
||||
fetch(url.toString()).then(function (response) {
|
||||
if (response.status === 404) throw "error";
|
||||
if (response.status > 299) throw "error";
|
||||
|
||||
return response.text();
|
||||
}).then(function (html) {
|
||||
|
||||
@@ -168,7 +168,7 @@ async fn status(
|
||||
// Check this first — paginated responses don't include the main tweet.
|
||||
if is_scroll {
|
||||
if conversation.replies.content.is_empty() {
|
||||
return Ok(StatusCode::NOT_FOUND.into_response());
|
||||
return Ok(StatusCode::NO_CONTENT.into_response());
|
||||
}
|
||||
let content = render_reply_chains(
|
||||
&conversation.replies.content,
|
||||
|
||||
Reference in new issue
Block a user