<commit_before>package com.enthusiast94.kafkatopicviewer.util;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

public class HttpResponseFactory {

    private final Gson gson = new Gson();

    public <T> ResponseEntity<String> createOkResponse(T body) {
        return new ResponseEntity<String>(gson.toJson(body), HttpStatus.OK);
    }

    public ResponseEntity<JsonObject> createInternalServerErrorResponse(String errorMessage) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("error", errorMessage);
        return new ResponseEntity<JsonObject>(jsonObject, HttpStatus.INTERNAL_SERVER_ERROR);
    }
}<commit_msg>Refactor.<commit_after>package com.enthusiast94.kafkatopicviewer.util;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

public class HttpResponseFactory {

    private final Gson gson = new Gson();

    public <T> ResponseEntity<String> createOkResponse(T body) {
        return new ResponseEntity<>(gson.toJson(body), HttpStatus.OK);
    }

    public ResponseEntity<String> createInternalServerErrorResponse(String errorMessage) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("error", errorMessage);
        return new ResponseEntity<>(gson.toJson(jsonObject), HttpStatus.INTERNAL_SERVER_ERROR);
    }
}
{'fraction_non_alphanumeric': 0.09662475181998677, 'fraction_numerical': 0.0026472534745201853, 'mean_word_length': 4.976284584980237, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '1118964', 'n_tokens_mistral': 430, 'n_tokens_neox': 420, 'n_words': 84}