File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,9 @@ CLASS zcl_http_agent IMPLEMENTATION.
5050 WHEN cl_abap_typedescr=>typekind_char.
5151 request->set_cdata( | { payload } | ).
5252 WHEN OTHERS .
53- zcx_error=>raise( | Unexpected payload type { payload_type->absolute_name } | ).
53+ RAISE EXCEPTION TYPE zcx_error_text
54+ EXPORTING
55+ text = | Unexpected payload type { payload_type->absolute_name } | .
5456 ENDCASE .
5557
5658 ENDMETHOD .
@@ -146,7 +148,10 @@ CLASS zcl_http_agent IMPLEMENTATION.
146148 IMPORTING
147149 code = status_code
148150 message = message ).
149- zcx_error=>raise( | HTTP error: [{ status_code } ] { message } | ).
151+
152+ RAISE EXCEPTION TYPE zcx_error_text
153+ EXPORTING
154+ text = | HTTP error: [{ status_code } ] { message } | .
150155 ENDIF .
151156
152157 result = lcl_http_response=>create( http_client ).
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ CLASS lcl_http_response IMPLEMENTATION.
7070 TRY .
7171 result = zcl_ajson=>parse( zif_http_response~cdata( ) ).
7272 CATCH zcx_ajson_error INTO DATA (error ).
73- zcx_error=>raise_with_text( error ) .
73+ RAISE EXCEPTION TYPE zcx_error_prev EXPORTING previous = error.
7474 ENDTRY .
7575
7676 ENDMETHOD .
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ CLASS zcl_http_login_manager DEFINITION
2222 !host TYPE csequence
2323 !username TYPE csequence
2424 !password TYPE csequence
25+ !is_basic TYPE abap_bool DEFAULT abap_true
2526 RETURNING
2627 VALUE (result ) TYPE string .
2728
@@ -101,7 +102,13 @@ CLASS zcl_http_login_manager IMPLEMENTATION.
101102 RETURN .
102103 ENDIF .
103104
104- result = | Basic { cl_http_utility=>encode_base64( | { username }:{ password }| ) } | .
105+ result = cl_http_utility=>encode_base64( | { username } :{ password } | ).
106+
107+ IF is_basic = abap_true .
108+ result = | Basic { result } | .
109+ ELSE .
110+ result = | Bearer { result } | .
111+ ENDIF .
105112
106113 append( host = host
107114 auth = result ).
You can’t perform that action at this time.
0 commit comments