Skip to content

Commit 2a94b47

Browse files
authored
Merge pull request #4110 from ralfhandl/3.1.1-uri-codeblocks
3.1.1: use specific custom languages uri and uritemplate
2 parents 204de0c + a540e45 commit 2a94b47

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

versions/3.1.1.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,7 @@ With this example, consider an `id` of `f81d4fae-7dec-11d0-a765-00a0c91e6bf6` an
17201720

17211721
Assuming the most compact representation of the JSON value (with unnecessary whitespace removed), we would expect to see the following request body, where space characters have been replaced with `+` and `+`, `"`, `{`, and `}` have been percent-encoded to `%2B`, `%22`, `%7B`, and `%7D`, respectively:
17221722

1723-
```urlencoded
1723+
```uri
17241724
id=f81d4fae-7dec-11d0-a765-00a0c91e6bf6&address=%7B%22streetAddress%22:%22123+Example+Dr.%22,%22city%22:%22Somewhere%22,%22state%22:%22CA%22,%22zip%22:%2299999%2B1234%22%7D
17251725
```
17261726

@@ -1729,7 +1729,7 @@ If it were treated as `application/json`, then the serialized value would be a J
17291729

17301730
Here is the `id` parameter (without `address`) serialized as `application/json` instead of `text/plain`, and then encoded per RFC1866:
17311731

1732-
```urlencoded
1732+
```uri
17331733
id=%22f81d4fae-7dec-11d0-a765-00a0c91e6bf6%22
17341734
```
17351735

@@ -1759,7 +1759,7 @@ requestBody:
17591759
Given a name of `example` and a solid red 2x2-pixel PNG for `icon`, this
17601760
would produce a request body of:
17611761

1762-
```urlencoded
1762+
```uri
17631763
name=example&icon=iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAABGdBTUEAALGPC_xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAAqADAAQAAAABAAAAAgAAAADO0J6QAAAAEElEQVQIHWP8zwACTGCSAQANHQEDqtPptQAAAABJRU5ErkJggg%3D%3D
17641764
```
17651765

@@ -4213,13 +4213,13 @@ parameters:
42134213
42144214
This translates to the following URI Template:
42154215
4216-
```urlencoded
4216+
```uritemplate
42174217
{?formulas*,words}
42184218
```
42194219

42204220
when expanded with the data given earlier, we get:
42214221

4222-
```urlencoded
4222+
```uri
42234223
?a=x%2By&b=x%2Fy&c=x%5Ey&words=math,is,fun
42244224
```
42254225

@@ -4253,7 +4253,7 @@ So we need to restructure the data to fit a manually constructed URI Template th
42534253

42544254
Here is one such template, using a made-up convention of `words.0` for the first entry in the words value, `words.1` for the second, and `words.2` for the third:
42554255

4256-
```urlencoded
4256+
```uritemplate
42574257
?a={+a}&b={+b}&c={+c}&words={words.0} {words.1} {words.2}
42584258
```
42594259

@@ -4279,7 +4279,7 @@ words.2: fun
42794279

42804280
Expanding our manually assembled template with our restructured data yields the following query string:
42814281

4282-
```urlencoded
4282+
```uri
42834283
?a=x%2By&b=x/y&c=x%5Ey&words=math%20is%20fun
42844284
```
42854285

@@ -4298,7 +4298,7 @@ words:
42984298

42994299
Using this data with our original RFC6570-friendly URI Template, `{?formulas*,words}`, produces the following:
43004300

4301-
```urlencoded
4301+
```uri
43024302
?words=hello,world
43034303
```
43044304

@@ -4313,13 +4313,13 @@ words.1: world
43134313

43144314
Manually constructed URI Template:
43154315

4316-
```urlencoded
4316+
```uritemplate
43174317
?words={words.0} {words.1}
43184318
```
43194319

43204320
Result:
43214321

4322-
```urlencoded
4322+
```uri
43234323
?words=hello%20world
43244324
```
43254325

@@ -4342,13 +4342,13 @@ Instead, we have to pre-percent-encode the name (which is a six-octet UTF-8 sequ
43424342
"%E2%9D%A4%EF%B8%8F": love!
43434343
```
43444344
4345-
```urlencoded
4345+
```uritemplate
43464346
{?%E2%9D%A4%EF%B8%8F}
43474347
```
43484348

43494349
This will expand to the result:
43504350

4351-
```urlencoded
4351+
```uri
43524352
?%E2%9D%A4%EF%B8%8F=love%21
43534353
```
43544354

0 commit comments

Comments
 (0)