Json via POST giving error

1

Hello! I am sending a Json through an HttpClient and it is returning an error about header. Does anyone know what it can be?

JsonDeDados = sender.sendMessageDATA();
            List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
            urlParameters.add(new BasicNameValuePair(infos, JsonDeDados));
            StringEntity entity = new StringEntity(JsonDeDados);

            post.setEntity(entity);
    
asked by anonymous 11.06.2018 / 21:06

1 answer

1

Header statement is missing

JsonDeDados = sender.sendMessageDATA();
            List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
            urlParameters.add(new BasicNameValuePair(infos, JsonDeDados));
            StringEntity entity = new StringEntity(JsonDeDados);

            post.setEntity(entity);
            post.setHeader("Content-Type", "application/json");

Test and tell us if it worked

    
11.06.2018 / 21:07