Better code to test similar functions but with chunked input
This commit is contained in:
@@ -161,7 +161,7 @@ feature {NONE} -- Events
|
||||
do
|
||||
get_http_session
|
||||
if attached http_session as sess then
|
||||
if attached sess.get (a_url, ctx) as res and then not res.error_occurred and then attached res.body as l_body then
|
||||
if attached sess.get (a_url, adapted_context (ctx)) as res and then not res.error_occurred and then attached res.body as l_body then
|
||||
assert ("Good answer got=%""+l_body+"%" expected=%""+a_expected_body+"%"", l_body.same_string (a_expected_body))
|
||||
else
|
||||
assert ("Request %""+a_url+"%" failed", False)
|
||||
@@ -173,7 +173,7 @@ feature {NONE} -- Events
|
||||
do
|
||||
get_http_session
|
||||
if attached http_session as sess then
|
||||
if attached sess.post (a_url, ctx, Void) as res and then not res.error_occurred and then attached res.body as l_body then
|
||||
if attached sess.post (a_url, adapted_context (ctx), Void) as res and then not res.error_occurred and then attached res.body as l_body then
|
||||
assert ("Good answer got=%""+l_body+"%" expected=%""+a_expected_body+"%"", l_body.same_string (a_expected_body))
|
||||
else
|
||||
assert ("Request %""+a_url+"%" failed", False)
|
||||
@@ -181,6 +181,16 @@ feature {NONE} -- Events
|
||||
end
|
||||
end
|
||||
|
||||
adapted_context (ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_REQUEST_CONTEXT
|
||||
do
|
||||
if ctx /= Void then
|
||||
Result := ctx
|
||||
else
|
||||
create Result.make
|
||||
end
|
||||
-- Result.set_proxy ("127.0.0.1", 8888) --| inspect traffic with http://www.fiddler2.com/
|
||||
end
|
||||
|
||||
feature -- Test routines
|
||||
|
||||
test_get_request_01
|
||||
|
||||
Reference in New Issue
Block a user