File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ impl ValBytesMode {
49
49
}
50
50
51
51
fn to_base64_urlsafe ( s : & str ) -> String {
52
- if s. contains ( '+' ) || s . contains ( '/' ) {
52
+ if s. contains ( |c| c == '+' || c == '/' ) {
53
53
s. replace ( '+' , "-" ) . replace ( '/' , "_" )
54
54
} else {
55
55
s. to_string ( )
Original file line number Diff line number Diff line change @@ -379,9 +379,9 @@ def test_partial_parse():
379
379
380
380
381
381
def test_json_bytes_base64_round_trip ():
382
- data = b'TDR3 \xbe \x11 J \xe9 \x9f \xa4 & \x91 \xff \xc8 \xef 4 \xdf \ xd3$ \xf3 ^ \xca \xb5 \x14 V \xde DH \n \x85 \x8b '
383
- encoded_std = b'"VERSM74RSumfpCaR/8jvNN/TJPNeyrUUViDeREgKhYs ="'
384
- encoded_url = b'"VERSM74RSumfpCaR_8jvNN_TJPNeyrUUViDeREgKhYs ="'
382
+ data = b'\xd8 \x07 \xc1 Tx$ \x91 F% \xf3 \xf3 I \xca \xd8 @ \x0c \xee \xc3 \xab \xff \x7f \ xd3\xcd \xcd \xf9 \xc2 \x10 \xe4 \xa1 \xb0 1e '
383
+ encoded_std = b'"2AfBVHgkkUYl8/NJythADO7Dq/9/083N+cIQ5KGwMWU ="'
384
+ encoded_url = b'"2AfBVHgkkUYl8_NJythADO7Dq_9_083N-cIQ5KGwMWU ="'
385
385
assert to_json (data , bytes_mode = 'base64' ) == encoded_url
386
386
387
387
v = SchemaValidator ({'type' : 'bytes' }, {'val_json_bytes' : 'base64' })
You can’t perform that action at this time.
0 commit comments