servicex-sh / httpx

httpx - CLI to test HTTP/gRPC/RSocket/Kafka... services by HTTP DSL
https://servicex.sh
Apache License 2.0
132 stars 9 forks source link

Crashes on DELETE call #13

Closed ssokolov1 closed 2 years ago

ssokolov1 commented 2 years ago
DELETE http://localhost:8080/api/v1/path/RetentionRules

^[[1m^[[31mStatus: 204  ^[[39m^[[21m^[[0m
^[[32mX-Frame-Options ^[[39m^[[0m: SAMEORIGIN
^[[32mReferrer-Policy ^[[39m^[[0m: strict-origin-when-cross-origin
^[[32mX-UA-Compatible ^[[39m^[[0m: IE=10; IE=11
^[[32mCache-Control ^[[39m^[[0m: no-cache
^[[32mX-Content-Type-Options ^[[39m^[[0m: nosniff
^[[32mContent-Security-Policy ^[[39m^[[0m: img-src data: blob: *; default-src blob: *; script-src 'unsafe-inline' 'unsafe-eval' data: *; style-src 'unsafe-inline' *; font-src data: *
^[[32mX-XSS-Protection ^[[39m^[[0m: 1; mode=block
^[[32mContent-Type ^[[39m^[[0m: application/json
^[[32mDate ^[[39m^[[0m: Thu, 25 Aug 2022 16:27:00 GMT

^[[2m2022-08-25 16:27:00.394^[[0;39m ^[[31mERROR^[[0;39m ^[[35m2272^[[0;39m ^[[2m---^[[0;39m ^[[2m[           main]^[[0;39m ^[[36morg.mvnsearch.http.HttpxCommand         ^[[0;39m ^[[2m:^[[0;39m HTX-002-500 - Failed to parse http code!

java.lang.NullPointerException: null
        at java.util.Objects.requireNonNull(Objects.java:208) ~[na:na]
        at java.util.ImmutableCollections$List12.<init>(ImmutableCollections.java:556) ~[na:na]
        at java.util.List.of(List.java:812) ~[httpx:na]
        at org.mvnsearch.http.protocol.HttpBaseExecutor.request(HttpBaseExecutor.java:110) ~[httpx:0.35.1]
        at org.mvnsearch.http.protocol.HttpExecutor.execute(HttpExecutor.java:43) ~[httpx:0.35.1]
        at org.mvnsearch.http.HttpxCommand.execute(HttpxCommand.java:345) ~[httpx:0.35.1]
        at org.mvnsearch.http.HttpxCommand.call(HttpxCommand.java:215) ~[httpx:0.35.1]

Response body is empty that why I guess. But should not fail. It is a legit case. Thank you one more time for excellent tool.

linux-china commented 2 years ago

Do you mind post your delete request? I can not reproduce it with following request.

### delete test
// @name delete-demo
DELETE https://httpbin.org/delete
ssokolov1 commented 2 years ago

Well, it is hard as service is behind corporate firewall. Only what I can help is to say that response status is 204 - no content. Empty body

`DELETE http://localhost:8080/nuxeo/api/v1/path/RetentionRules

Status: 204
X-Frame-Options : SAMEORIGIN Referrer-Policy : strict-origin-when-cross-origin X-UA-Compatible : IE=10; IE=11 Cache-Control : no-cache X-Content-Type-Options : nosniff Content-Security-Policy : img-src data: blob: ; default-src blob: ; script-src 'unsafe-inline' 'unsafe-eval' data: ; style-src 'unsafe-inline' ; font-src data: * X-XSS-Protection : 1; mode=block Content-Type : application/json Date : Mon, 29 Aug 2022 11:55:08 GMT

2022-08-29 11:55:09.121 ERROR 2946 --- [ main] org.mvnsearch.http.HttpxCommand : HTX-002-500 - Failed to parse http code!

java.lang.NullPointerException: null at java.util.Objects.requireNonNull(Objects.java:208) ~[na:na] at java.util.ImmutableCollections$List12.(ImmutableCollections.java:556) ~[na:na] at java.util.List.of(List.java:812) ~[httpx:na] at org.mvnsearch.http.protocol.HttpBaseExecutor.request(HttpBaseExecutor.java:110) ~[httpx:0.35.1] at org.mvnsearch.http.protocol.HttpExecutor.execute(HttpExecutor.java:43) ~[httpx:0.35.1] at org.mvnsearch.http.HttpxCommand.execute(HttpxCommand.java:345) ~[httpx:0.35.1] at org.mvnsearch.http.HttpxCommand.call(HttpxCommand.java:215) ~[httpx:0.35.1] at org.mvnsearch.http.HttpxCommand.call(HttpxCommand.java:34) ~[httpx:0.35.1] at picocli.CommandLine.executeUserObject(CommandLine.java:1953) ~[httpx:4.6.3] at picocli.CommandLine.access$1300(CommandLine.java:145) ~[httpx:4.6.3] at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358) ~[na:na] at picocli.CommandLine$RunLast.handle(CommandLine.java:2352) ~[na:na] at picocli.CommandLine$RunLast.handle(CommandLine.java:2314) ~[na:na] at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179) ~[httpx:4.6.3] at picocli.CommandLine$RunLast.execute(CommandLine.java:2316) ~[na:na] at picocli.CommandLine.execute(CommandLine.java:2078) ~[httpx:4.6.3] at org.mvnsearch.http.HttpFileRunner.run(HttpFileRunner.java:24) ~[httpx:0.35.1] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:771) ~[httpx:2.7.2] at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:755) ~[httpx:2.7.2] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[httpx:2.7.2] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[httpx:2.7.2] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[httpx:2.7.2] at org.mvnsearch.http.HttpxApplication.main(HttpxApplication.java:23) ~[httpx:0.35.1] `

apatrida commented 2 years ago

I have similar crashes on 401 responses.

❯  httpx -f src/test/http/devices-auth.http

POST http://localhost:9090/device/auth/test-ABC-123-XYZ-001

Status: 401 Unauthorized 
Content-Type : application/json
www-authenticate : Bearer
content-length : 0

2022-10-09 11:58:13.090 ERROR 46815 --- [           main] org.mvnsearch.http.HttpxCommand          : HTX-002-500 - Failed to parse http code!

java.lang.NullPointerException: null
        at java.util.Objects.requireNonNull(Objects.java:208) ~[na:na]
        at java.util.ImmutableCollections$List12.<init>(ImmutableCollections.java:556) ~[na:na]
        at java.util.List.of(List.java:812) ~[httpx:na]
        at org.mvnsearch.http.protocol.HttpBaseExecutor.request(HttpBaseExecutor.java:110) ~[httpx:0.35.1]
        at org.mvnsearch.http.protocol.HttpExecutor.execute(HttpExecutor.java:43) ~[httpx:0.35.1]
        at org.mvnsearch.http.HttpxCommand.execute(HttpxCommand.java:345) ~[httpx:0.35.1]
        at org.mvnsearch.http.HttpxCommand.call(HttpxCommand.java:238) ~[httpx:0.35.1]
        at org.mvnsearch.http.HttpxCommand.call(HttpxCommand.java:34) ~[httpx:0.35.1]
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953) ~[httpx:4.6.3]
        at picocli.CommandLine.access$1300(CommandLine.java:145) ~[httpx:4.6.3]
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358) ~[na:na]
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2352) ~[na:na]
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2314) ~[na:na]
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179) ~[httpx:4.6.3]
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2316) ~[na:na]
        at picocli.CommandLine.execute(CommandLine.java:2078) ~[httpx:4.6.3]
        at org.mvnsearch.http.HttpFileRunner.run(HttpFileRunner.java:24) ~[httpx:0.35.1]
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:771) ~[httpx:2.7.2]
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:755) ~[httpx:2.7.2]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[httpx:2.7.2]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[httpx:2.7.2]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[httpx:2.7.2]
        at org.mvnsearch.http.HttpxApplication.main(HttpxApplication.java:23) ~[httpx:0.35.1]
linux-china commented 2 years ago

@apatrida @ssokolov1 guys, I'm sorry about this bug, and it's caused by NPE List.of(bytes). Please update to version 0.35.2

ssokolov1 commented 2 years ago

NPE issue is fixed. Thank you very much !!! However, sorry to say, there is a new one. That is about destination of saved files. I am running a command in testing directory where file test-api-retention.http is located and there is a subfolder resources

httpx -f rest-api-retention.http -p docker -a

### Download random logo to use as attachment to the file
GET {{logo}}

>>! resources/logo.png

2022-10-10 11:04:07.103 ERROR 29167 --- [ main] org.mvnsearch.http.HttpxCommand : HTX-002-500 - Failed to parse http code!

java.nio.file.FileSystemException: rest-api-retention.http/resources/logo.png: Not a directory at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218) ~[httpx:na]

Here is the problem. It is trying to append script name to the current path, what is wrong in my opinion as rest-api-retention.http is a file, not a directory. IntelliJ internal runner handles it correctly. I can create a new issue if it helps. And one more time, thank you for your great work.

apatrida commented 2 years ago

probably best to report new bug under new issue.

linux-china commented 2 years ago

@ssokolov1 I created an issue for your question. #16