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
Howdy! I'm building a REST API w/ falcon and am trying to write a POST test that spoofs an HTML form and can't quite figure out what I'm doing wrong here.
TypeError: a bytes-like object is required, not 'dict'
If I pass the body in as a string literal instead of a dict(), I don't get any errors but the request doesn't parse out the body as params - I've got to parse the body manually via req.stream.read().
The text was updated successfully, but these errors were encountered:
asonnenschein
changed the title
How to spoof POST params in test?
How to pass POST params in test?
Jan 28, 2016
OK, figured this one out - I had a look at the pytest-falcon code by @yohanboniface and figured out what I was doing wrong here. I didn't add the correct 'Content-Type' header and I didn't encode the body!
Howdy! I'm building a REST API w/ falcon and am trying to write a POST test that spoofs an HTML form and can't quite figure out what I'm doing wrong here.
In this example -
The test fails with this error:
If I pass the body in as a string literal instead of a dict(), I don't get any errors but the request doesn't parse out the body as params - I've got to parse the body manually via
req.stream.read()
.The text was updated successfully, but these errors were encountered: