-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Request data doesn't clean up after calling newRequest() #1778
Comments
Thanks @galimru, I'll take a look. Can you confirm that if you start with |
Hello, I am seeing this as well on jsoup 1.15.2. I have to submit a series of forms to get through an OAuth2 login. protected Document submitForm(Document doc, String id, Map<String, String> values) throws IOException {
// REDACTED CODE to look up form & set values
logger.debug("submitting form " + id + " to " + form.attr("action"));
form.formData().forEach((keyval) -> {
logger.debug("- " + keyval.key() + " = " + keyval.value());
});
logger.debug("actual data");
Connection foo = form.submit();
foo.request().data().forEach((keyval) -> {
logger.debug("- " + keyval.key() + " = " + keyval.value());
});
return foo.execute().parse();
//return form.submit().execute().parse();
}
Note the first 3 form data elements are left over from a previous form. I am calling |
And adding |
Thanks, fixed! |
Enables multi-step forms, or requests after a form submission, without sending data from earlier submissions. Fixes #1778
Hey
I have an issue when trying to use the same connection after submitting the form.
The method
newRequest()
makes copydata
params and it leads that this request preserve data from previous request.There is no way to clean up
data
params. So when I use the same connection to "navigate link" it serializes data params as query parameters:And moreover it will keep send data from previous form if you use subsequence of form submit calls.
jsoup/src/main/java/org/jsoup/nodes/FormElement.java
Lines 72 to 75 in b0ac5e0
I believe we shouldn't do a copy of
data
params here:jsoup/src/main/java/org/jsoup/helper/HttpConnection.java
Line 671 in b0ac5e0
The text was updated successfully, but these errors were encountered: