2 Replies Latest reply on Mar 26, 2014 3:04 PM by Chris Child

    Set ContentType for Javascript Network API

    Chris Child

      Hello,

       

      So I've run into an issue and I think the problem is that I'm incorrectly setting the content type for my Network post call or not at all. I am going to a Java back end and returning some json. I've looked at the json after it has been returned and I verified it on jsonlint.com. When I look at the json on the rho side it hasn't been encoded properly so I see &quot rather than ".

       

      I looked into NetworkImpl.cpp and found the following below but I'm not sure this is the right class to be looking at.

       

      if ( propertyMap.containsKey("contentEncoding") ) {

              body = getEncodedBody(body,propertyMap.get("contentEncoding"));

      }


      So I tried adding it to the property hash below.


      var getProps = {

        url: "http://localhost:8001?method=getOrders",

        headers: {},

        body: "",

        contentEncoding: "application/json; charset=utf-8"

        };

       

      Thanks

       

      Chris