File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
rust-runtime/aws-smithy-http Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ tracing = "0.1"
2929# We are using hyper for our streaming body implementation, but this is an internal detail.
3030hyper = " 0.14.12"
3131
32+ # For support streaming lambda_http::Body
33+ lambda_http = " 0.6.0"
34+
3235# ByteStream internals
3336futures-core = " 0.3.14"
3437tokio = { version = " 1.6" , optional = true }
Original file line number Diff line number Diff line change @@ -250,6 +250,22 @@ impl From<hyper::Body> for SdkBody {
250250 }
251251}
252252
253+ impl From < lambda_http:: Body > for SdkBody {
254+ fn from ( body : lambda_http:: Body ) -> Self {
255+ let hyper_body = match body {
256+ lambda_http:: Body :: Empty => hyper:: Body :: empty ( ) ,
257+ lambda_http:: Body :: Text ( s) => hyper:: Body :: from ( s) ,
258+ lambda_http:: Body :: Binary ( v) => hyper:: Body :: from ( v) ,
259+ } ;
260+
261+ SdkBody {
262+ inner : Inner :: Streaming { inner : hyper_body } ,
263+ rebuild : None ,
264+ callbacks : Vec :: new ( ) ,
265+ }
266+ }
267+ }
268+
253269impl From < Vec < u8 > > for SdkBody {
254270 fn from ( data : Vec < u8 > ) -> Self {
255271 Self :: from ( Bytes :: from ( data) )
Original file line number Diff line number Diff line change @@ -445,6 +445,12 @@ impl From<hyper::Body> for ByteStream {
445445 }
446446}
447447
448+ impl From < lambda_http:: Body > for ByteStream {
449+ fn from ( input : lambda_http:: Body ) -> Self {
450+ ByteStream :: new ( SdkBody :: from ( input) )
451+ }
452+ }
453+
448454#[ derive( Debug ) ]
449455pub struct Error ( Box < dyn StdError + Send + Sync + ' static > ) ;
450456
You can’t perform that action at this time.
0 commit comments