Skip to content
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

unable to read post data when run with --debug #55

Closed
munkyboy opened this issue May 28, 2016 · 3 comments
Closed

unable to read post data when run with --debug #55

munkyboy opened this issue May 28, 2016 · 3 comments

Comments

@munkyboy
Copy link

munkyboy commented May 28, 2016

given the endpoint:

- request:
    method: [POST]
    url: /foo
    post: "^qqq=123$"

running with --debug causes this error:

 POST [stubs]/foo: Error when extracting POST body: java.util.NoSuchElementException, returning null..

In debug mode, the raw HTTP request is parsed and dumped to stdout. Later, the code reads the request input stream to process the post body and the stream has already been drained to perform the previous dump.

The error occurs in the extractPostRequestBody method of main/java/by/stub/utils/HandlerUtils.java

@azagniotov
Copy link
Owner

@munkyboy Thank you for that. I apologize for the late reply. I will look into this

@azagniotov
Copy link
Owner

Interestingly, it is not because of extractPostRequestBody:

When dumping raw HttpServletRequest to console during --debug, I am calling request.getParameterNames(). Jetty's Request implementing the HttpServletRequest would eventually call the request.getInputStream() without me realizing

@azagniotov
Copy link
Owner

Fixed in v4.0.0

azagniotov added a commit that referenced this issue Oct 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants