-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Description
When making HTTP requests with no headers, the Java HttpClient throws an IllegalArgumentException: wrong number, 0, of parameters error.
Stack Trace
Caused by: java.lang.IllegalArgumentException: wrong number, 0, of parameters
at java.net.http/jdk.internal.net.http.common.Utils.newIAE(Utils.java:326)
at java.net.http/jdk.internal.net.http.HttpRequestBuilderImpl.headers(HttpRequestBuilderImpl.java:135)
at java.net.http/jdk.internal.net.http.HttpRequestBuilderImpl.headers(HttpRequestBuilderImpl.java:43)
Expected Behavior
Wirespec should handle requests with no headers gracefully, without throwing an exception.
Current Workaround
Adding a dummy header to ensure the headers array is not empty:
.let { it + arrayOf("test", "value") }Context
This issue was discovered while integrating the bunq-sdk built on wirespec. The workaround is currently necessary to prevent crashes when no headers are required for the API request.
References
- Related PR: Replace official bunq-sdk with flock bunq-sdk build on wirespec ZzAve/teambalance#296 (comment)
- Reported by: @ZzAve
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels