You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import HTTPretty
HTTPretty.register_uri(HTTPretty.GET, "http://github.com/gabrielfalcao",
body="this is supposed to be the response",
adding_headers={
'Server': 'Apache',
'Content-Length': '23456789',
'Content-Type': 'application/json',
})
The expected content-length is 23456789 but the actual expected body has len 35
The DEFAULT behaviour is to raise an exception that says:
HTTPretty got inconsistent parameters. The header content-length expects size `23456789`
but the body you registered for that has length `35`
Fix that, or if you really want that, call register_uri with "fill_with" callback. See the documentation for more.
Then the person can set the kwarg fill_with=lambda filedescriptor: "foobar", for example.
Or even use builtin callbacks such as:
import HTTPretty
HTTPretty.register_uri(HTTPretty.GET, "http://github.com/gabrielfalcao",
body="this is supposed to be the response",
fill_with=HTTPretty.zeros,
adding_headers={
'Server': 'Apache',
'Content-Length': '23456789',
'Content-Type': 'application/json',
})
The text was updated successfully, but these errors were encountered:
The first behaviour is:
The expected content-length is
23456789
but the actual expected body has len35
The DEFAULT behaviour is to raise an exception that says:
Then the person can set the kwarg fill_with=lambda filedescriptor: "foobar", for example.
Or even use builtin callbacks such as:
The text was updated successfully, but these errors were encountered: