HTTP API: 404 for a chat id the list of chats leaves out (closes #5)
check / check (push) Successful in 1m19s
check / check (push) Successful in 1m19s
The chat client keeps contact records that GET /api/v1/chats does not list, such as the bot's own profile (1 on a new profile) and a contact it creates itself (2), and reads or sends in them when asked. The message endpoints now look the id up, through chatID in internal/api/chats.go, in the same list the chats endpoint answers with, and answer 404 for any id not in it. The webhook endpoints can call chatID too. Model: opus-5-5
This commit is contained in:
@@ -54,7 +54,7 @@ func TestNoChats(t *testing.T) {
|
||||
func TestChatsFailure(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
rec := request(t, newAPI(credential, &fakeClient{err: errChat}),
|
||||
rec := request(t, newAPI(credential, &fakeClient{contactsErr: errChat}),
|
||||
http.MethodGet, chatsPath, bearer)
|
||||
|
||||
want := `{"error":"the chats could not be read"}` + "\n"
|
||||
|
||||
Reference in New Issue
Block a user