From 5e05fe8e7877ffd6bc473b77b8ca0a12ad26bd67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 14 Mar 2024 16:23:56 +0100 Subject: Cowboy 2.12, Cowlib 2.13, Gun 2.1 --- .../2.12/manual/cowboy_req.parse_qs/index.html | 208 +++++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 docs/en/cowboy/2.12/manual/cowboy_req.parse_qs/index.html (limited to 'docs/en/cowboy/2.12/manual/cowboy_req.parse_qs/index.html') diff --git a/docs/en/cowboy/2.12/manual/cowboy_req.parse_qs/index.html b/docs/en/cowboy/2.12/manual/cowboy_req.parse_qs/index.html new file mode 100644 index 00000000..fc7dc78c --- /dev/null +++ b/docs/en/cowboy/2.12/manual/cowboy_req.parse_qs/index.html @@ -0,0 +1,208 @@ + + + + + + + + + + Nine Nines: cowboy_req:parse_qs(3) + + + + + + + + + + + + + + + +
+
+
+
+ +

cowboy_req:parse_qs(3)

+ +

Name

+

cowboy_req:parse_qs - Parse the query string

+

Description

+
+
parse_qs(Req :: cowboy_req:req())
+    -> [{Key :: binary(), Value :: binary() | true}]
+
+

Parse the query string as a list of key/value pairs.

+

Arguments

+
Req
+

The Req object.

+
+
+

Return value

+

The parsed query string is returned as a list of key/value pairs. The key is a binary string. The value is either a binary string, or the atom true. Both key and value are case sensitive.

+

The atom true is returned when a key is present in the query string without a value. For example, in the following URIs the key <<"edit">> will always have the value true:

+
  • /posts/42?edit +
  • +
  • /posts/42?edit&exclusive=1 +
  • +
  • /posts/42?exclusive=1&edit +
  • +
  • /posts/42?exclusive=1&edit&from=web +
  • +
+

Changelog

+
  • 2.0: The parsed value is not longer cached in the Req object. +
  • +
  • 2.0: Only the parsed query string is returned, it is no longer wrapped in a tuple. +
  • +
  • 2.0: Function introduced. Replaces qs_val/1 and qs_vals/1. +
  • +
+

Examples

+
Parse the query string and convert the keys to atoms
+
+
ParsedQs = cowboy_req:parse_qs(Req),
+AtomsQs = [{binary_to_existing_atom(K, latin1), V}
+    || {K, V} <- ParsedQs].
+
+

See also

+

cowboy_req(3), cowboy_req:qs(3), cowboy_req:match_qs(3)

+ + + + + + +
+ +
+ + +

+ Cowboy + 2.12 + Function Reference + +

+ + + +

Navigation

+ +

Version select

+ + +

Like my work? Donate!

+

Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:

+
+ + + + + + + + + +

Recurring payment options are also available via GitHub Sponsors. These funds are used to cover the recurring expenses like food, dedicated servers or domain names.

+ + + +
+
+
+
+ + + + + + + + + -- cgit v1.2.3