我正在使用fetch进行API调用并获得JSON响应。
但它会在android上引发异常,但可在iOS上运行。
df.sum(axis=1) # This sums each row
错误:-
“ TypeError:网络请求失败。
在XMLHttpRequest.xhr.onerror中(blob:http://localhost:8081/1a80ef13-8ce9-4c75-a477-e214c5fd3ff2:24140:18)。using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Xunit; namespace Functions.Tests { public class FunctionsTests { private readonly ILogger logger = TestFactory.CreateLogger(); [Fact] public async void Http_trigger_should_return_known_string() { var request = TestFactory.CreateHttpRequest("name", "Bill"); var response = (OkObjectResult)await HttpFunction.Run(request, logger); Assert.Equal("Hello, Bill", response.Value); } [Theory] [MemberData(nameof(TestFactory.Data), MemberType = typeof(TestFactory))] public async void Http_trigger_should_return_known_string_from_member_data(string queryStringKey, string queryStringValue) { var request = TestFactory.CreateHttpRequest(queryStringKey, queryStringValue); var response = (OkObjectResult)await HttpFunction.Run(request, logger); Assert.Equal($"Hello, {queryStringValue}", response.Value); } } }
答案 0 :(得分:0)
使用服务器的IP地址代替url中的localhost:8081。