@@ -41,28 +41,27 @@ case class Part[+T](
41
41
// enumerate all variants so that overload resolution works correctly
42
42
override def header (h : String ): Option [String ] = super .header(h)
43
43
44
- /**
45
- * Returns the value of the `Content-Disposition` header, which should be used when sending this part in a
46
- * multipart request.
47
- *
48
- * The syntax is specified by [[https://datatracker.ietf.org/doc/html/rfc6266#section-4.1 RFC6266 section 4.1 ]].
49
- * For safety and simplicity, disposition parameter values are represented as `quoted-string`, defined in
50
- * [[https://datatracker.ietf.org/doc/html/rfc9110#section-5.6.4 RFC9110 section 5.6.4 ]].
51
- *
52
- * `quoted-string` allows usage of visible ASCII characters (`%x21-7E`), except for `"` and `\`, which must be escaped
53
- * with a backslash. Additionally, space and horizontal tab is allowed, as well as octets `0x80-FF` (`obs-data`).
54
- * In practice this means that - while not explicitly allowed - non-ASCII UTF-8 characters are valid
55
- * according to this grammar. Additionally, [[https://datatracker.ietf.org/doc/html/rfc6532#section-3.2 RFC6532 ]]
56
- * makes it more explicit that non-ASCII UTF-8 is allowed. Control characters are not allowed.
57
- *
58
- * This method makes sure that `"` and `\` are escaped, while leaving possible rejection of forbidden characters to
59
- * lower layers (`sttp` backends).
60
- */
44
+ /** Returns the value of the `Content-Disposition` header, which should be used when sending this part in a multipart
45
+ * request.
46
+ *
47
+ * The syntax is specified by [[https://datatracker.ietf.org/doc/html/rfc6266#section-4.1 RFC6266 section 4.1 ]]. For
48
+ * safety and simplicity, disposition parameter values are represented as `quoted-string`, defined in
49
+ * [[https://datatracker.ietf.org/doc/html/rfc9110#section-5.6.4 RFC9110 section 5.6.4 ]].
50
+ *
51
+ * `quoted-string` allows usage of visible ASCII characters (`%x21-7E`), except for `"` and `\`, which must be
52
+ * escaped with a backslash. Additionally, space and horizontal tab is allowed, as well as octets `0x80-FF`
53
+ * (`obs-data`). In practice this means that - while not explicitly allowed - non-ASCII UTF-8 characters are valid
54
+ * according to this grammar. Additionally, [[https://datatracker.ietf.org/doc/html/rfc6532#section-3.2 RFC6532 ]]
55
+ * makes it more explicit that non-ASCII UTF-8 is allowed. Control characters are not allowed.
56
+ *
57
+ * This method makes sure that `"` and `\` are escaped, while leaving possible rejection of forbidden characters to
58
+ * lower layers (`sttp` backends).
59
+ */
61
60
def contentDispositionHeaderValue : String = {
62
61
def escape (str : String ): String = str.flatMap {
63
- case '"' => " \\\" "
62
+ case '"' => " \\\" "
64
63
case '\\ ' => " \\\\ "
65
- case c => c.toString
64
+ case c => c.toString
66
65
}
67
66
" form-data; " + dispositionParamsSeq.map { case (k, v) => s """ $k=" ${escape(v)}" """ }.mkString(" ; " )
68
67
}
0 commit comments