Skip to content

Commit

Permalink
feat: support to output a big string (#26)
Browse files Browse the repository at this point in the history
* feat: support to output a big string

* Update StringService.java

* Update test-suite.yaml
  • Loading branch information
LinuxSuRen authored Apr 27, 2024
1 parent 6be6ecd commit 1830e53
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions e2e/test-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ items:
expect:
body: |
{"name":"rick","age":18}
- name: big
request:
api: /big
query:
size: "1"
header:
Authorization: "{{ .param.auth }}"
Content-Type: application/json
expect:
body: |
{"message":"m","data":null}
## Cookies
- name: no-cookie
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/io/github/devopsws/demo/service/StringService.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,19 @@ public Message base64(@RequestBody Message message) {
public Object echo(@RequestBody Object payload) {
return payload;
}

@GetMapping("/big")
public Message big(@RequestParam(required = true) int size) {
Message msg = new Message();
StringBuffer buf = new StringBuffer();
if (size < 0) {
buf.append("size needs to be positive");
} else {
for (int i = 0; i < size; i++) {
buf.append("m");
}
}
msg.setMessage(buf.toString());
return msg;
}
}

0 comments on commit 1830e53

Please sign in to comment.