HttpClient header

dako
2022-07-05
2022-07-19
  • dako - 2022-07-05

    Hello,

    We want to send in Codesys the POST request with a header consisting of two parts:

    'Authorization': "Basic ZGlzdHJpYnV0b3I6NjJxNA=="
    'Content-Type': "application/json"
    

    The Post Commands was tested successfully with a python script so we are sure, that our request is built correctly.

    We are able in Codesys to successfully send a header which consist of one part only:

    wsHeader := "Authorization: Basic ZGlzdHJpYnV0b3I6NjJxNA=="
    

    We have no idea how to send in Codesys a header which has more than one part. We tried a lot of syntax, split parts with $R$N, commas, etc.. And nothing works. We got all the time a response from the server:

    "{"error_human": "missing_content_type_json_header", "error_code": "missing_content_type_json_header", "args": {}}$N"
    

    Could anyone help us? Examples from Codesys contain only one-part headers.

    Thanks in advance!

     
  • nothinrandom - 2022-07-19

    there should be an input field called eContentType. Fill out this field with Web_Client.CONTENT_TYPE.APPLICATION_JSON

     

Log in to post a comment.