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

Tests and documentation about passing data and files to browser._request() via kwargs arg #274

Open
MartinDlry opened this issue Mar 26, 2019 · 1 comment
Labels
easy? Probably easy to implement, or WIP almost complete help wanted

Comments

@MartinDlry
Copy link
Contributor

MartinDlry commented Mar 26, 2019

The function _request(self, form, url=None, **kwargs) from the Browser class retrieves data and files from kwargs argument :

data = kwargs.pop("data", dict())
files = kwargs.pop("files", dict())

However, this way of submitting data or files is not tested nor documented.

@hemberger hemberger added help wanted easy? Probably easy to implement, or WIP almost complete labels Mar 27, 2019
@MartinDlry
Copy link
Contributor Author

MartinDlry commented Mar 28, 2019

I tried writing tests for this, but I've found a new issue.

After retrieving fields from kwargs["data"], the function processes fields inside form argument.
But, when processing these fields, it does not check if they were already filled with kwargs["data"], and the final request contains more than one value for the field. This could be considered as a normal behavior, except when the concerned fields are empty in the form argument.

For example, with a text input field named "test" , if we leave it empty, then call browser._request(data={"test": "mytext"}) ,
the resulting request will contain both "" and "mytext" for "test"field value.

To avoid this we could choose that kwargs["data] is priority, and, for each key in kwargs["data"], we will ignore the the corresponding field value in the form argument.

Do i have to open a new issue for this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy? Probably easy to implement, or WIP almost complete help wanted
Projects
None yet
Development

No branches or pull requests

2 participants