レッスン 2

Query Parameter Models 日本語ガイド

日本語の url parser query parameter models ガイド: Understand repeated keys, empty values, flags, arrays, and framework differences.

このコンテンツはまだ日本語で用意されていません。ローカライズが完了するまで English 版を表示しています。

Query strings look like simple key-value pairs, but different frameworks model them differently.

?tag=api&tag=json&draft=&preview

A parser might see:

  • tag as two values
  • draft as an empty string
  • preview as a flag or as an empty value

Repeated keys

Repeated keys are legal in a query string:

?tag=frontend&tag=backend

Some frameworks keep the last value. Some collect all values into an array. Some require a naming convention such as tag[].

Empty values and flags

These are not identical in every system:

?debug
?debug=
?debug=true

If the server treats presence as true, ?debug may be enough. If it expects a boolean string, it may need debug=true.

Ordering

For ordinary filtering, parameter order usually does not matter. For signatures and cache keys, order can matter a lot. Signed URLs often require a canonical order and exact percent-encoding.

Safer mental model

Do not assume that parsing and rebuilding a query is harmless. Decide how your application treats:

  • Repeated keys
  • Empty strings
  • Missing values
  • Array syntax
  • Sorting
  • Encoding of spaces and plus signs

Once those rules are explicit, URL bugs become much easier to reproduce.

実践したいときは関連する DevCove ツールを使えます。任意であり、このレッスンの必須部分ではありません。

関連ツールを開く

コース概要へ戻る