docs: update SSL test program

test both github.com and api.github.com

api.github.com is used when pushing code back to github, via the 2FA framework
This commit is contained in:
Lars Hvam 2018-05-27 15:48:36 +02:00 committed by GitHub
parent 174f9eafa7
commit 4faaa25131
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,21 +11,34 @@ REPORT zabapgit_test_ssl.
* See https://github.com/larshp/abapGit/ * See https://github.com/larshp/abapGit/
PARAMETERS: p_url TYPE swc_value DEFAULT 'https://github.com', PARAMETERS: p_url1 TYPE swc_value DEFAULT 'https://github.com',
p_proxy TYPE string, p_url2 TYPE swc_value DEFAULT 'https://api.github.com'.
p_pxport TYPE string. * api.github.com is used when pushing code back to github
SELECTION-SCREEN BEGIN OF BLOCK proxy WITH FRAME.
* proxy settings, fill if your system is behind a proxy
PARAMETERS: p_proxy TYPE string,
p_pxport TYPE string,
p_puser TYPE string,
p_ppwd TYPE string.
SELECTION-SCREEN END OF BLOCK proxy.
START-OF-SELECTION. START-OF-SELECTION.
PERFORM run. PERFORM run USING p_url1.
PERFORM run USING p_url2.
FORM run. FORM run USING iv_url TYPE swc_value.
DATA: lv_code TYPE i, DATA: lv_code TYPE i,
lv_url TYPE string, lv_url TYPE string,
li_client TYPE REF TO if_http_client, li_client TYPE REF TO if_http_client,
lv_error_message TYPE string. lv_error_message TYPE string.
lv_url = p_url. IF iv_url IS INITIAL.
RETURN.
ENDIF.
lv_url = iv_url.
cl_http_client=>create_by_url( cl_http_client=>create_by_url(
EXPORTING EXPORTING
url = lv_url url = lv_url
@ -35,11 +48,12 @@ FORM run.
IMPORTING IMPORTING
client = li_client ). client = li_client ).
* enter username and password for proxy authentication if needed IF NOT p_puser IS INITIAL.
* li_client->authenticate( li_client->authenticate(
* proxy_authentication = abap_true proxy_authentication = abap_true
* username = '' username = p_puser
* password = '' ). password = p_ppwd ).
ENDIF.
li_client->send( ). li_client->send( ).
li_client->receive( li_client->receive(
@ -65,7 +79,7 @@ FORM run.
IMPORTING IMPORTING
code = lv_code ). code = lv_code ).
IF lv_code = 200. IF lv_code = 200.
WRITE: / 'Success, it works'. WRITE: / lv_url, ': ok'.
ELSE. ELSE.
WRITE: / 'Error', lv_code. WRITE: / 'Error', lv_code.
ENDIF. ENDIF.