cl_http_client无法使用换行符设置标题

2020-09-05 11:31发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)我必须发送带有标头的http请求...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


我必须发送带有标头的http请求,该标头包含换行符(具体来说为 )。 (这是允许的,请参见 https://tools.ietf.org/html/rfc2616#section -2.2

如果我创建一个字符串(iv_mystring_with_cr_lf)并包含`cl_abap_char_utilities => cr_lf`并将该字符串作为值传递给`lo_http_client-> request-> set_header_field(name ='HeaderName'value = iv_mystring_with_cr_lf)',我会收到。 一个http_communication_failure错误,我们将调用lr_http_client-> send()。 如果我删除cr_lf字符,则一切正常,除了我的标题错误...

我错过了什么吗? 有什么解决方法吗? 不幸的是,我必须使用 发送标头。

这是一个转储的最小示例。

数据:
          lo_http_client类型参考if_http_client,
          lv_somestring类型的字符串,
          lv_url类型的字符串。

   lv_url ='http://example.org'。

   cl_http_client => create_by_url(
       出口
         网址= lv_url
         ssl_id ='DFAULT'
       输入
         客户= lo_http_client)。

   lv_somestring ='测试'。
   将lv_somestring cl_abap_char_utilities => cr_lf lv_somestring合并为lv_somestring。

   lo_http_client-> request-> set_header_field(name ='someHeader'value = lv_somestring)。

   lo_http_client-> send()。  "崩溃。