Spring Boot with h2load is not recognizing response code

Viewed 18

My problem

A very simple @RestController is not recognized by the h2load tool.

My code

@RestController
@RequestMapping("/v1")
public class EntityController {

  @GetMapping("/entities")
  public @ResponseBody ResponseEntity<List<ENTITY>> get() {
     ...
  }

  private void onSuccess(final List<Entity> entities) {
    setResponse(ResponseEntity.ok(entities));
  }

  private void onEmpty() {
    setResponse(ResponseEntity.noContent().build());
  }
}

Testing

A very simple test like this: h2load -v --h1 "http://172.26.68.67:8080/v1/entities" .

<THE JSON BODY RETURNED SUCCESSFULLY>

progress: 100% done
0


finished in 243.98ms, 4.10 req/s, 72.18KB/s
requests: 1 total, 1 started, 1 done, 0 succeeded, 1 failed, 0 errored, 0 timeout
status codes: 0 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 17.61KB (18034) total, 85B (85) headers (space savings 0.00%), 17.47KB (17892) data
                     min         max         mean         sd        +/- sd
time for request:   241.28ms    241.28ms    241.28ms         0us   100.00%
time for connect:     2.45ms      2.45ms      2.45ms         0us   100.00%
time to 1st byte:   230.17ms    230.17ms    230.17ms         0us   100.00%
req/s           :       4.10        4.10        4.10        0.00   100.00%

As you can see, all request were interpreted as failed. Doesn't matter how many requests I try.

Now using cURL like this: curl -i -v "http://172.26.68.67:8080/v1/entities".

*   Trying 172.26.68.67:8080...
* Connected to 172.26.68.67 (172.26.68.67) port 8080 (#0)
> GET /v1/entities HTTP/1.1
> Host: 172.26.68.67:8080
> User-Agent: curl/7.83.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 
HTTP/1.1 200 
< Content-Type: application/json
Content-Type: application/json
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Date: Thu, 11 Aug 2022 17:19:52 GMT
Date: Thu, 11 Aug 2022 17:19:52 GMT

< 
<THE JSON BODY RETURNED SUCCESSFULLY>

What is wrong?

References

  1. https://codeutility.org/spring-boot-h2load-does-not-recognize-the-correct-response-status-200-stack-overflow/
0 Answers
Related