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

Mock content length #55

Closed
domoritz opened this issue Apr 30, 2013 · 1 comment
Closed

Mock content length #55

domoritz opened this issue Apr 30, 2013 · 1 comment

Comments

@domoritz
Copy link

If you want to test whether a certain content length is handled properly, you would write

HTTPretty.register_uri(
            HTTPretty.GET,'http://example.com',
            content_length=MAX_CONTENT_LENGTH + 1,
            content_type='application/json')

Which leads to the following error:

HTTPrettyError: HTTPretty got inconsistent parameters. The header Content-Length you registered expects size "10485761" but the body you registered for that has actually length "12".

What is the correct way to mock the content-length?

@gabrielfalcao
Copy link
Owner

If you want to pass the content_length, you should also pass a body with the same length, otherwise http libraries will go crazy

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