@@ -24,7 +24,7 @@ pub async fn register(
2424 . method ( Method :: POST )
2525 . uri ( & url)
2626 // This value must match the binary name, or this call will 403
27- . header ( constants:: EXTENSION_NAME_HEADER , "rotel-lambda- extension" )
27+ . header ( constants:: EXTENSION_NAME_HEADER , "rotel-extension" )
2828 . header (
2929 constants:: EXTENSION_ACCEPT_FEATURE ,
3030 constants:: EXTENSION_FEATURE_ACCOUNTID ,
@@ -33,17 +33,24 @@ pub async fn register(
3333 . body ( Full :: from ( Bytes :: from ( serde_json:: to_vec ( & events) ?) ) ) ?;
3434
3535 let resp = client. request ( req) . await ?;
36- if resp. status ( ) != 200 {
36+ let ( parts, body) = resp. into_parts ( ) ;
37+ let status = parts. status ;
38+
39+ if status != 200 {
40+ let text = body
41+ . collect ( )
42+ . await
43+ . map_err ( |e| format ! ( "Failed to read response body from {}: {}" , url, e) )
44+ . map ( |c| c. to_bytes ( ) )
45+ . map ( |s| String :: from_utf8 ( s. to_vec ( ) ) ) ?
46+ . map_err ( |e| format ! ( "Unable to convert response body to string: {}" , e) ) ?;
3747 return Err ( format ! (
38- "Can not register extension at {}, got {}" ,
39- url,
40- resp. status( )
48+ "Can not register extension at {}, got {}: {}" ,
49+ url, status, text,
4150 )
4251 . into ( ) ) ;
4352 }
4453
45- let ( parts, body) = resp. into_parts ( ) ;
46-
4754 let ext_id = match parts. headers . get ( constants:: EXTENSION_ID_HEADER ) {
4855 None => {
4956 return Err ( "Can not get extension id, got no header" . into ( ) ) ;
0 commit comments