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
In many cases, the parameters for expect_request() is very long, especially when multiple headers are specified or the request have a long data or json in its body.
In such case the expect_request() call can be very long. If it bothers the developer, it needs to be shortened, for example by moving the literals to variables and then specifying the variables for the expect_request() call.
In some cases, there are common expectations specified for each request, such as the content-type header is set to application/json.
It would be great to somehow bake a command, similar to the sh package's bake method.
So, it would look like:
server=httpserver.bake(headers={"content-type": "application/json"}) # and probably other common kwargsserver.expect_request("/foo", json={"foo": "bar"}).respond_with_json({"foo": "bar"})
Here, the bake is similar to the functools.partial function so it creates a new httpserver-like object whose defaults are changed.
The text was updated successfully, but these errors were encountered:
In many cases, the parameters for expect_request() is very long, especially when multiple headers are specified or the request have a long data or json in its body.
In such case the
expect_request()
call can be very long. If it bothers the developer, it needs to be shortened, for example by moving the literals to variables and then specifying the variables for theexpect_request()
call.In some cases, there are common expectations specified for each request, such as the
content-type
header is set toapplication/json
.It would be great to somehow bake a command, similar to the
sh
package'sbake
method.So, it would look like:
Here, the
bake
is similar to thefunctools.partial
function so it creates a new httpserver-like object whose defaults are changed.The text was updated successfully, but these errors were encountered: