B4J Question HTTPJOB.PutString and HttpMediaTypeNotSupportedException

Discussion in 'B4J Questions' started by lancaster, May 14, 2019.

  1. lancaster

    lancaster Member Licensed User

    I am attempting to make a PUT request to a REST API setting the headers of Content-Type:application/json and Accept:application/json and of course passing a valid json string in the body of the request.

    The remote service returns "HttpMediaTypeNotSupportedException" "Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported" where clearly this is not the content-type I am specifying in the header.

    Ironically I can use POSTMAN with exactly the same headers and json payload and the remote service accepts the request.

    This suggests to me that the HTTP client stack is inserting an alternative Content-Type header.

    Has anyone encountered similar? Thanks
  2. Erel

    Erel Administrator Staff Member Licensed User

    Where is the relevant code?
  3. keirS

    keirS Well-Known Member Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice