takes: TkSlf4j can fail for specific request
Hi.
If TkSlf4j wraps Take that returns empty response (without body),
and if POST request with some body has been sent through VerboseWire (from jcabi-http),
RqMethod.Base will fail with this exception:
java.io.IOException: Invalid HTTP method: X-Takes-LocalAddress:
at org.takes.rq.RqMethod$Base.method(RqMethod.java:127)
at org.takes.tk.TkSlf4j.act(TkSlf4j.java:105)
at org.takes.http.BkBasic.print(BkBasic.java:108)
at org.takes.http.BkBasic.accept(BkBasic.java:84)
at org.takes.http.BkParallel$1$1.run(BkParallel.java:89)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Test for reproducing:
@Test
public void test() throws IOException {
new FtRemote(
new TkSlf4j(
req -> new RsEmpty()
)
).exec(
home ->
new JdkRequest(home)
.method("POST")
.body().set("test").back()
.through(VerboseWire.class)
.fetch()
.as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK)
);
}
Environment: java - 1.8.0_102-b14 takes - 1.1 jcabi-http - 1.16
http:
POST / HTTP/1.1
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.8.0_102
Host: localhost:41997
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-type: application/x-www-form-urlencoded
Content-Length: 4
testHTTP/1.1 200 OK
HTTP/1.1 500 Internal Error
Content-Length: 538
Content-Type: text/plain
java.io.IOException: Invalid HTTP method: X-Takes-LocalAddress:
.at org.takes.rq.RqMethod$Base.method(RqMethod.java:127)
.at org.takes.tk.TkSlf4j.act(TkSlf4j.java:105)
.at org.takes.http.BkBasic.print(BkBasic.java:108)
.at org.takes.http.BkBasic.accept(BkBasic.java:84)
.at org.takes.http.BkParallel$1$1.run(BkParallel.java:89)
.at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
.at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
.at java.lang.Thread.run(Thread.java:745)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 48 (23 by maintainers)
Commits related to this issue
- WIP for proposed solution to issue https://github.com/yegor256/takes/issues/712 — committed to rui-castro/takes by rui-castro 8 years ago
- #712 BkBasic requests handling fix — committed to prondzyn/takes by prondzyn 8 years ago
- #712 removing unnecessary casting — committed to prondzyn/takes by prondzyn 8 years ago
- #712 removing implementation and keeping test — committed to prondzyn/takes by prondzyn 7 years ago
- #712 test method name change — committed to prondzyn/takes by prondzyn 7 years ago
- #712 test name fix — committed to prondzyn/takes by prondzyn 7 years ago
- #712 puzzle description update — committed to prondzyn/takes by prondzyn 7 years ago
@rui-castro you’re working with this ticket for the last 15 days. If it is not closed within the next 48 hours, it will be re-assigned to someone else, see No Obligations principle. This article should help if you’re stuck… -30 added to your rating, at the moment it is: -30