Repository navigation
fix: 空の本文(204)と文字列の応答の扱いを直す - #120
Merged
Merged
Conversation
Co-Authored-By: Codex Sol <noreply@openai.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
Misskey は API が
null/undefinedを返すとき、HTTP 204(本文なし・Content-Type なし)で応答する。また、文字列の結果はJSON.stringifyした JSON テキストを、JSON の Content-Type なしで送る。これらをライブラリが扱えていなかった問題の修正。変更内容
破壊的変更
NotesApi.translateの戻り値をMisskeyNoteTranslation?に変更。本文・CW とも空のノート(本文のない純粋なリノートなど)を翻訳すると、Misskey は 204 を返す。従来は型エラーで失敗していた。翻訳する本文がないときnullを返す。呼び出し側でnullを扱う修正
RegistryApi.get:nullを保存した値が、nullではなく空文字で返っていた問題を修正(204 のときnull)RegistryApi.get: 保存した文字列が、JSON の引用符つき("dark")で返っていた問題を修正。JSON の Content-Type がない応答で、JSON の文字列として解釈できるときだけ復号する。JSON の Content-Type の応答は Dio が復号済みなので、二重に復号しない(Dio の MIME 判定に合わせている)FormatException(エンドポイント名付き)で通知する内部
MisskeyHttp.sendに@internalのoptionalJsonValue引数を追加(既定はfalseで既存の挙動は変わらない)。公開 API の export は変更なしドキュメント
api/account.md(Registry)と、api/notes.md(Translation の例。日本語版には該当の節がない)を更新確認
dart analyze --fatal-infos・dart format・dart test(974 件)が成功docsのnpm run buildが全 6 言語で成功ApiCallService.ts、notes/translate.ts、i/registry/get.ts)に照合