Skip to content

Fix #146: PaginationMetaで返すURLに重複クエリパラメータを保持する#151

Merged
yu23ki14 merged 1 commit intomainfrom
devin/1745815111-fix-pagination-meta-urls
Apr 28, 2025
Merged

Fix #146: PaginationMetaで返すURLに重複クエリパラメータを保持する#151
yu23ki14 merged 1 commit intomainfrom
devin/1745815111-fix-pagination-meta-urls

Conversation

@devin-ai-integration
Copy link
Contributor

概要 / Overview

Issue #146 を修正します。

問題 / Problem

PaginationMetaで返すURLについて、同じクエリパラメータが2回以上指定されたときに最後のもの以外が消えてしまう問題がありました。

例:

$ curl -sS 'https://birdxplorer.onrender.com/api/v1/data/search?language=en&topic_ids=58&note_status=NEEDS_MORE_RATINGS&note_status=CURRENTLY_RATED_HELPFUL&note_created_at_from=1727622000000&note_created_at_to=1730300400000&x_user_followers_count_from=1000&offset=0&limit=25' | jq -r '.meta.next'

出力では note_status が2回指定されているが、最後の CURRENTLY_RATED_HELPFUL 以外が消えていました。

解決策 / Solution

dict(request.query_params) を使用するとPythonの辞書の制約により重複キーが失われるため、代わりに request.url.query から生のクエリ文字列を取得し、parse_qs で解析することで重複キーを保持するようにしました。

テスト / Testing

  • 新しいテストケースを追加し、重複クエリパラメータが正しく保持されることを確認しました。
  • また、既存のテストがすべて通ることを確認しました。

Link to Devin run: https://app.devin.ai/sessions/ea5e8f0d875a49a9874764657cc61c33
Requested by: [email protected]

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@yu23ki14 yu23ki14 merged commit fe12c2a into main Apr 28, 2025
3 checks passed
@ayuki-joto ayuki-joto deleted the devin/1745815111-fix-pagination-meta-urls branch August 18, 2025 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant