Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

400 Bad Request response from Zilla when Using Java HttpClient #1192

Closed
ankitk-me opened this issue Aug 13, 2024 · 0 comments · Fixed by #1194
Closed

400 Bad Request response from Zilla when Using Java HttpClient #1192

ankitk-me opened this issue Aug 13, 2024 · 0 comments · Fixed by #1194
Assignees
Labels
bug Something isn't working

Comments

@ankitk-me
Copy link
Contributor

Describe the bug
When utilizing Java's HttpRequest and HttpClient classes to send a POST or PUT request to Zilla (http-kafka), a 400 Bad Request response is returned. However, the same endpoint functions correctly when tested with Postman and curl.

To Reproduce
Steps to reproduce the behavior:

  1. Start Zilla with the http-kafka configuration.
  2. Implement the following Java code to trigger an HTTP request:
HttpRequest httpRequest = HttpRequest.newBuilder(URI.create("http://localhost:%d".formatted(7114)).resolve("/items"))
            .POST(HttpRequest.BodyPublishers.ofString(body))
            .build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
  1. Observe that the HTTP response code received is 400 Bad Request.

Expected behavior
The HTTP response code should be 204 No Content instead of 400 Bad Request.

@ankitk-me ankitk-me added the bug Something isn't working label Aug 13, 2024
@jfallows jfallows self-assigned this Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants