<commit_before>package org.ihtsdo.snomed.rvf.importer.helper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 * A simple REST client that communicates with the RVF API. This class is used to populate the RVF database.
 */
@Service
public class RvfRestClient {

    private static final Logger logger = LoggerFactory.getLogger(RvfRestClient.class);
    private String serverUrl = "http://localhost:8080/api/v1/";
    @Autowired
    private RestTemplate restTemplate;
    private HttpHeaders headers;

    public RvfRestClient() {
        this.restTemplate = new RestTemplate();
        this.headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        headers.add("Accept", "*/*");
        // verify server url
        setServerUrl(serverUrl);
    }

    public ResponseEntity get(String uri) {
        HttpEntity<String> requestEntity = new HttpEntity<>("", headers);
        return restTemplate.exchange(serverUrl + uri, HttpMethod.GET, requestEntity, String.class);
    }

    public ResponseEntity post(String uri, String json) {
        HttpEntity<String> requestEntity = new HttpEntity<>(json, headers);
        return restTemplate.exchange(serverUrl + uri, HttpMethod.POST, requestEntity, String.class);
    }

    public ResponseEntity put(String uri, String json, Class clazz) {
        HttpEntity<String> requestEntity = new HttpEntity<>(json, headers);
        return restTemplate.exchange(serverUrl + uri, HttpMethod.PUT, requestEntity, clazz);
    }
<commit_msg>RVF-115: FIXED : Accept headers now correctly set for Importer Rest client<commit_after>package org.ihtsdo.snomed.rvf.importer.helper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 * A simple REST client that communicates with the RVF API. This class is used to populate the RVF database.
 */
@Service
public class RvfRestClient {

    private static final Logger logger = LoggerFactory.getLogger(RvfRestClient.class);
    private String serverUrl = "http://localhost:8080/api/v1/";
    @Autowired
    private RestTemplate restTemplate;
    private HttpHeaders headers;

    public RvfRestClient() {
        this.restTemplate = new RestTemplate();
        this.headers = new HttpHeaders();
        headers.add("Content-Type", MediaType.APPLICATION_JSON_VALUE);
        headers.add("Accept", MediaType.APPLICATION_JSON_VALUE);
        // verify server url
        setServerUrl(serverUrl);
    }

    public ResponseEntity get(String uri) {
        HttpEntity<String> requestEntity = new HttpEntity<>("", headers);
        return restTemplate.exchange(serverUrl + uri, HttpMethod.GET, requestEntity, String.class);
    }

    public ResponseEntity post(String uri, String json) {
        HttpEntity<String> requestEntity = new HttpEntity<>(json, headers);
        return restTemplate.exchange(serverUrl + uri, HttpMethod.POST, requestEntity, String.class);
    }

    public ResponseEntity put(String uri, String json, Class clazz) {
        HttpEntity<String> requestEntity = new HttpEntity<>(json, headers);
        return restTemplate.exchange(serverUrl + uri, HttpMethod.PUT, requestEntity, clazz);
    }

{'fraction_non_alphanumeric': 0.10005184033177812, 'fraction_numerical': 0.0044064282011404875, 'mean_word_length': 4.0776315789473685, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3526260', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1041, 'n_words': 269}