@@ -237,6 +237,14 @@ impl ScopeInner {
237237 pub ( crate ) fn usecase ( & self ) -> & Usecase {
238238 & self . usecase
239239 }
240+
241+ fn as_path_segment ( & self ) -> & str {
242+ if self . scope . is_empty ( ) {
243+ "_"
244+ } else {
245+ & self . scope
246+ }
247+ }
240248}
241249
242250impl std:: fmt:: Display for ScopeInner {
@@ -265,12 +273,12 @@ impl Scope {
265273 }
266274
267275 fn for_organization ( usecase : Usecase , organization : u64 ) -> Self {
268- let scope = format ! ( "org. {}" , organization) ;
276+ let scope = format ! ( "org= {}" , organization) ;
269277 Self ( Ok ( ScopeInner { usecase, scope } ) )
270278 }
271279
272280 fn for_project ( usecase : Usecase , organization : u64 , project : u64 ) -> Self {
273- let scope = format ! ( "org.{}/ project. {}" , organization, project) ;
281+ let scope = format ! ( "org={}; project= {}" , organization, project) ;
274282 Self ( Ok ( ScopeInner { usecase, scope } ) )
275283 }
276284
@@ -286,10 +294,10 @@ impl Scope {
286294 Self :: validate_value ( & value) ?;
287295
288296 if !inner. scope . is_empty ( ) {
289- inner. scope . push ( '/ ' ) ;
297+ inner. scope . push ( '; ' ) ;
290298 }
291299 inner. scope . push_str ( key) ;
292- inner. scope . push ( '. ' ) ;
300+ inner. scope . push ( '= ' ) ;
293301 inner. scope . push_str ( & value) ;
294302
295303 Ok ( inner)
@@ -441,11 +449,10 @@ impl Session {
441449 let mut segments = url. path_segments_mut ( ) . unwrap ( ) ;
442450 segments
443451 . push ( "v1" )
444- . extend ( self . scope . usecase . name . split ( "/" ) ) ;
445- if !self . scope . scope . is_empty ( ) {
446- segments. extend ( self . scope . scope . split ( "/" ) ) ;
447- }
448- segments. push ( "objects" ) . extend ( object_key. split ( "/" ) ) ;
452+ . push ( "objects" )
453+ . push ( & self . scope . usecase . name )
454+ . push ( self . scope . as_path_segment ( ) )
455+ . extend ( object_key. split ( "/" ) ) ;
449456 drop ( segments) ;
450457
451458 url
@@ -491,7 +498,7 @@ mod tests {
491498
492499 assert_eq ! (
493500 session. object_url( "foo/bar" ) . to_string( ) ,
494- "http://127.0.0.1:8888/v1/testing/org. 12345/ project. 1337/ app_slug. email_app/objects /foo/bar"
501+ "http://127.0.0.1:8888/v1/objects/ testing/org= 12345; project= 1337; app_slug= email_app/foo/bar"
495502 )
496503 }
497504
@@ -504,7 +511,7 @@ mod tests {
504511
505512 assert_eq ! (
506513 session. object_url( "foo/bar" ) . to_string( ) ,
507- "http://127.0.0.1:8888/api/prefix/v1/testing/org. 12345/ project. 1337/objects /foo/bar"
514+ "http://127.0.0.1:8888/api/prefix/v1/objects/ testing/org= 12345; project= 1337/foo/bar"
508515 )
509516 }
510517}
0 commit comments