Commit 3208e24
Fix Edm.Binary literal representation
While Edm.Binary values are Base64 encoded in JSON payload [1][1], the
specification demands a prefixed and quoted Base16 encoding for values in URIs
and HTTP headers [2][2].
As there has been no specific conversion for Edm.Binary so far and we want to
stay backward compatible, the Python side representation shall remain a string
with the Base64 encoded payload.
However there are cases, where the literal is generated from the payload and
sent to the server, that expects it in the correct format. E.g. this happens
when building the resource path while using a Edm.Binary property as an entity
key (see #187 and phanak-sap/pyodata-issue-files#2).
Another case might be when using the $include filter for a Edm.Binary property.
To meet those requirements, we want to have these representations:
JSON | Python | Literal
--------|--------------|------------------------
Base64 | str (Base64) | prefixed quoted Base16
This adds a specific type for Edm.Binary with the necessary conversions.
Further it extends the test cases to cover those conversions.
As the Edm.Binary type has been used to test the generic prefixed conversions,
we need to switch this to the Edm.Byte type, that remains generic.
[1](https://www.odata.org/documentation/odata-version-2-0/json-format)
[2](https://www.odata.org/documentation/odata-version-2-0/overview/)1 parent 7d65f74 commit 3208e24
2 files changed
+27
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
197 | | - | |
| 198 | + | |
198 | 199 | | |
199 | 200 | | |
200 | 201 | | |
| |||
361 | 362 | | |
362 | 363 | | |
363 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
364 | 377 | | |
365 | 378 | | |
366 | 379 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
| 370 | + | |
371 | 371 | | |
372 | | - | |
373 | | - | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
374 | 383 | | |
375 | 384 | | |
376 | 385 | | |
| |||
1462 | 1471 | | |
1463 | 1472 | | |
1464 | 1473 | | |
1465 | | - | |
| 1474 | + | |
0 commit comments