Skip to content

bugfix: undertow has missing request body #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions examples/http/requests.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### POST request
POST http://localhost:8080/
Content-Type: application/json

{
"name": 1
}

### GET request
GET http://localhost:8080/?fromDate=2020-01-01

### GET request (with body)
GET http://localhost:8080/?fromDate=2020-01-01
Content-Type: application/json

{}
2 changes: 1 addition & 1 deletion examples/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ paths:
description: Update index
operationId: postIndex
requestBody:
required: false
required: true
content:
application/json:
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public MultiReadContentCachingRequestWrapper(HttpServletRequest request, int con

@Override
public ServletInputStream getInputStream() throws IOException {
var inputStream = super.getInputStream();
if (inputStream.isFinished()) {
return new CachedServletInputStream(getContentAsByteArray());
var cachedContent = getContentAsByteArray();
if (cachedContent.length > 0) {
return new CachedServletInputStream(cachedContent);
}

return inputStream;
return super.getInputStream();
}

@Override
Expand Down