fix content is null or ''
This commit is contained in:
parent
083f2cee66
commit
85d4cf17bd
|
|
@ -150,17 +150,20 @@ public class PlaywrightInstance : IDisposable
|
|||
ResponseInMemory = args.ResponseInMemory
|
||||
};
|
||||
|
||||
var html = await response.TextAsync();
|
||||
if (response.Headers["content-type"].Contains("application/json"))
|
||||
{
|
||||
if (response.Status == 200 && response.Ok)
|
||||
{
|
||||
var json = await response.JsonAsync();
|
||||
result.ResponseData = JsonSerializer.Serialize(json);
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(html))
|
||||
{
|
||||
var json = await response.JsonAsync();
|
||||
result.ResponseData = JsonSerializer.Serialize(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var html = await response.TextAsync();
|
||||
result.ResponseData = html;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue