File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
sdk/cosmos/azure_data_cosmos/src Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -490,7 +490,11 @@ impl ContainerClient {
490490 item_id : & str ,
491491 options : Option < ItemOptions < ' _ > > ,
492492 ) -> azure_core:: Result < Response < T > > {
493- let options = options. unwrap_or_default ( ) ;
493+ let mut options = options. unwrap_or_default ( ) ;
494+
495+ // Read APIs should always return the item, ignoring whatever the user set.
496+ options. enable_content_response_on_write = true ;
497+
494498 let link = self . items_link . item ( item_id) ;
495499 let url = self . pipeline . url ( & link) ;
496500 let mut req = Request :: new ( url, Method :: Get ) ;
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ pub const POST_TRIGGER_INCLUDE: HeaderName =
3535 HeaderName :: from_static ( "x-ms-documentdb-post-trigger-include" ) ;
3636pub const SESSION_TOKEN : HeaderName = HeaderName :: from_static ( "x-ms-session-token" ) ;
3737pub const INDEXING_DIRECTIVE : HeaderName = HeaderName :: from_static ( "x-ms-indexing-directive" ) ;
38+ pub const SUB_STATUS : HeaderName = HeaderName :: from_static ( "x-ms-substatus" ) ;
3839
3940pub const QUERY_CONTENT_TYPE : ContentType = ContentType :: from_static ( "application/query+json" ) ;
4041
Original file line number Diff line number Diff line change @@ -66,7 +66,9 @@ impl CosmosPipeline {
6666 resource_link : ResourceLink ,
6767 ) -> azure_core:: Result < BufResponse > {
6868 let ctx = ctx. with_value ( resource_link) ;
69- self . pipeline . send ( & ctx, request) . await
69+ let r = self . pipeline . send ( & ctx, request) . await ?;
70+ let r = azure_core:: http:: check_success ( r) . await ?;
71+ Ok ( r)
7072 }
7173
7274 pub async fn send < T > (
@@ -77,7 +79,7 @@ impl CosmosPipeline {
7779 ) -> azure_core:: Result < Response < T > > {
7880 self . send_raw ( ctx, request, resource_link)
7981 . await
80- . map ( |r| r . into ( ) )
82+ . map ( Into :: into)
8183 }
8284
8385 pub fn send_query_request < T : DeserializeOwned + Send > (
@@ -108,6 +110,7 @@ impl CosmosPipeline {
108110 }
109111
110112 let resp = pipeline. send ( & ctx, & mut req) . await ?;
113+ let resp = azure_core:: http:: check_success ( resp) . await ?;
111114 let page = FeedPage :: < T > :: from_response ( resp) . await ?;
112115
113116 Ok ( page. into ( ) )
You can’t perform that action at this time.
0 commit comments