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

Add a live test case for sending one or more file(s) using doRequest #16

Open
MartinKersten opened this issue Sep 25, 2012 · 7 comments
Milestone

Comments

@MartinKersten
Copy link
Member

Currently multi-part submit and doRequest are not tested and should be tested using a real web site.

@jheintz
Copy link
Member

jheintz commented Sep 28, 2012

Martin, is this a requirement for milestone 0.9?

@MartinKersten
Copy link
Member Author

Well I dont think so, but it is a test we are lacking. So we can not
guarantee bug free behaviour.

2012/9/28 John Heintz [email protected]

Martin, is this a requirement for milestone 0.9?


Reply to this email directly or view it on GitHubhttps://github.com//issues/16#issuecomment-8963174.

@MartinKersten
Copy link
Member Author

I just thought about, we do not need a live server to test the multi-part form features as well. We just need to submit the code against the mock agent. If you not specify a value for the file upload element (or set it to nothing) it will fail.

Doing so we are able to test this in isolation. We can test all the multi-part form variants, too (file stream and alike) and also we can test the content body. I guess we can even test it by inspecting the request object created (getEntity should be available if not we just extend the request object to make it available or 'remember' the way it was created).

If we make the entity element available using the request object we must take care for the file bodies and content body. The request is stored along the page being received (resource for later version) -> page.getRequest() (?). So this information is available within the history as well.

So the best is to limit each request object to store the header fields, parameters, url and for every body content or file parameter we could provide the first 4KB and the overall size. Also this might become a configuration issue. But this would be designing ahead. So I guess we stick to 4KB limit since this should work for the most requests and only file transmitting and longer text might become a problem, if the text is not submitted using a normal parameter (which will not be affected by this restriction) but the multipart is used or a content body.

I guess these are two or more additional issues.

@jheintz
Copy link
Member

jheintz commented Oct 2, 2012

@MartinKersten can you look at the latest changes I made to master to extend the unit tests? (197db64)
It's not complete but I think it's in the direction that you are describing testing with mock agent.

@louisnayegon
Copy link

I've got problems with multi part requests, not sure if this code is correct

    HttpPost request = (!hasFiles()) || isMultiPart ? composePostRequest(getBaseUri(), parameters) :
        composeMultiPartFormRequest(getBaseUri(), parameters, files);

should it be

    HttpPost request = (hasFiles() || isMultiPart) ? composeMultiPartFormRequest(getBaseUri(), parameters, files) :
                  composePostRequest(getBaseUri(), parameters);

@jheintz
Copy link
Member

jheintz commented Apr 15, 2013

Hello Louis,

Your suggestion certainly looks right in email... let me take a look today
or tomorrow and patch it.

Cheers,
John

ps - the project has been stalled, but it's still live. I've been busy with
consulting and another project but I really appreciate your interest!

On Mon, Apr 15, 2013 at 1:01 PM, Louis Henry Nayegon <
[email protected]> wrote:

I've got problems with multi part requests, not sure if this code is
correct

HttpPost request = (!hasFiles()) || isMultiPart ? composePostRequest(getBaseUri(), parameters) :
    composeMultiPartFormRequest(getBaseUri(), parameters, files);

should it be

HttpPost request = (hasFiles() || isMultiPart) ? composeMultiPartFormRequest(getBaseUri(), parameters, files) :
              composePostRequest(getBaseUri(), parameters);


Reply to this email directly or view it on GitHubhttps://github.com//issues/16#issuecomment-16401218
.

John D. Heintz
Agile, Lean, and everything in between

President, Gist Labs http://gistlabs.com
Senior Consultant, Cutter Consortium http://cutter.com

Twitter: @jheintz http://twitter.com/jheintz Phone: 512-633-1198

http://gistlabs.com

jheintz added a commit that referenced this issue Apr 23, 2013
@jheintz
Copy link
Member

jheintz commented Apr 23, 2013

@louisnayegon I've just published 0.11.1-SNAPSHOT that includes the fix for this into the maven repos. (At least I think I have :)

Can you try that version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants