简体   繁体   中英

Flurl Http GetAsync() - How to verify response text?

I am struggeling with Flurl.Http to verify the response text of a GetAsync() request. My code:

var resp = await "https://.../version"
                .GetAsync();

Assert.Equal(200, resp.StatusCode);
Assert.Equal("1.0.0.0", resp.WhatDoIHaveToDoHere?);

Someone here who knows how to do that?

I assume you're expecting 1.0.0.0 to be in the body of the response? If so, this should do it:

Assert.Equal("1.0.0.0", await resp.GetStringAsync());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM