Skip to content

Commit 570e037

Browse files
committed
Support cookies and char-type payload
1 parent 018f02b commit 570e037

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

src/package.devc.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
44
<asx:values>
55
<DEVC>
6-
<CTEXT>HTTP</CTEXT>
6+
<CTEXT>Easy HTTP</CTEXT>
77
</DEVC>
88
</asx:values>
99
</asx:abap>

src/zcl_http_agent.clas.abap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ CLASS zcl_http_agent IMPLEMENTATION.
4747
request->set_data( payload ).
4848
WHEN cl_abap_typedescr=>typekind_string.
4949
request->set_cdata( payload ).
50+
WHEN cl_abap_typedescr=>typekind_char.
51+
request->set_cdata( |{ payload }| ).
5052
WHEN OTHERS.
5153
zcx_error=>raise( |Unexpected payload type { payload_type->absolute_name }| ).
5254
ENDCASE.

src/zcl_http_agent.clas.locals_imp.abap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ CLASS lcl_http_response IMPLEMENTATION.
8585

8686
DATA headers TYPE tihttpnvp.
8787

88-
result = NEW #( ).
88+
" HTTP headers are not case sensitive and can have multiple entries (i.e. for cookies)
89+
result = NEW #( iv_case_insensitive = abap_true iv_list_mode = abap_true ).
8990

9091
http_response->get_header_fields( CHANGING fields = headers ).
9192

src/zif_http_agent.intf.abap

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ INTERFACE zif_http_agent PUBLIC.
2222
authorization TYPE string VALUE 'authorization',
2323
content_type TYPE string VALUE 'content-type',
2424
user_agent TYPE string VALUE 'user-agent',
25+
cookie TYPE string VALUE 'cookie',
26+
set_cookie TYPE string VALUE 'set-cookie',
27+
x_csrf_token TYPE string VALUE 'x-csrf-token',
2528
END OF c_header,
2629
BEGIN OF c_content_type,
2730
json TYPE string VALUE 'application/json',
2831
text TYPE string VALUE 'application/text',
32+
xml TYPE string VALUE 'application/xml',
2933
bin TYPE string VALUE 'application/octet-stream',
3034
END OF c_content_type.
3135

@@ -40,7 +44,7 @@ INTERFACE zif_http_agent PUBLIC.
4044
!method TYPE string DEFAULT c_method-get
4145
!query TYPE REF TO zcl_abap_string_map OPTIONAL
4246
!headers TYPE REF TO zcl_abap_string_map OPTIONAL
43-
!payload TYPE any OPTIONAL " can be string, xstring
47+
!payload TYPE any OPTIONAL " can be char, string, xstring
4448
RETURNING
4549
VALUE(result) TYPE REF TO zif_http_response
4650
RAISING

0 commit comments

Comments
 (0)