Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:white_check_mark: Correct spinBlockDOM size limit test https://github.com/siyuan-note/siyuan/issues/18732

Daniel628518083790
diff --git a/kernel/api/lute_authorization_test.go b/kernel/api/lute_authorization_test.go
index b481c6d6af..c1da27574e 100644
--- a/kernel/api/lute_authorization_test.go
+++ b/kernel/api/lute_authorization_test.go
@@ -116,7 +116,22 @@ func TestSpinBlockDOMInputSizeLimit(t *testing.T) {
request.Header.Set("Content-Type", "application/json")
engine.ServeHTTP(recorder, request)
- if recorder.Code != http.StatusRequestEntityTooLarge {
- t.Fatalf("unexpected status code: got %d, want %d", recorder.Code, http.StatusRequestEntityTooLarge)
+ if recorder.Code != http.StatusOK {
+ t.Fatalf("unexpected status code: got %d, want %d", recorder.Code, http.StatusOK)
+ }
+
+ response := &struct {
+ Code int `json:"code"`
+ Msg string `json:"msg"`
+ }{}
+ if err := json.Unmarshal(recorder.Body.Bytes(), response); err != nil {
+ t.Fatal(err)
+ }
+ if response.Code != http.StatusRequestEntityTooLarge {
+ t.Fatalf("unexpected response code: got %d, want %d", response.Code, http.StatusRequestEntityTooLarge)
+ }
+ const expectedMessage = "dom input exceeds the maximum permitted size"
+ if response.Msg != expectedMessage {
+ t.Fatalf("unexpected response message: got %q, want %q", response.Msg, expectedMessage)
}
}