How to make a JSON POST request from Java client to Python FastAPI server?
How to make a JSON POST request from Java client to Python FastAPI server? Question: I send a post request from a java springboot application like this: String requestBody = gson.toJson(sbert); System.out.println(requestBody); // If I print this, and use this in postman it works! HttpRequest add_request = HttpRequest.newBuilder() .uri(URI.create("http://localhost:4557/sbert_similarity")) .POST(HttpRequest.BodyPublishers.ofString(requestBody)) .header("Content-Type", "application/json") .build(); HttpResponse<String> response …