我正在开发一个公共 API,用户将在参数中发送 byte[]。我已经实现了 API 方法并想要对其进行测试,但是如果我在邮递员中尝试,则无法发送字节[]。出现以下错误
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "|e1896d86-412b7762126469ae.",
"errors": {
"$": [
"The JSON value could not be converted to System.Byte[]. Path: $ | LineNumber: 0 | BytePositionInLine: 1."
]
}
Run Code Online (Sandbox Code Playgroud)
}
API方法参数
public IActionResult Upload(int clientId, string dtName, byte[] dtValues, bool append)
{
}
Run Code Online (Sandbox Code Playgroud)
邮递员电话
我正在开发 Blazor 服务器端应用程序,并且有一个绑定动态菜单的标头。还有一个类别页面,我在其中显示基于已绑定在标题菜单中的查询字符串的数据。
一旦我选择菜单并且类别页面显示代表查询字符串值的数据,OnInitializedAsync 方法就会被调用,但我再次打开菜单并选择不同的产品,然后类别页面不会被调用。
下面是标题菜单的代码。
Header.razor(这是在主布局页面上注册的)
<ul class="cat_menu">
@if (categoryDtos == null)
{
<div>Loading...</div>
}
else
{
@foreach (var category in categoryDtos)
{
<li><a href="category/@category.Id">@category.Name<i class="fas fa-chevron-right"></i></a></li>
}
}
</ul>
public class HeaderBase : ComponentBase
{
[Inject] public IToastService toastService { get; set; }
[Inject] ICategoryService categoryService { get; set; }
public List<CategoryDto> categoryDtos { get; set; }
protected async override Task OnInitializedAsync()
{
var categoryLIst = await categoryService.GetCategories();
if (categoryLIst.Data != null)
{
categoryDtos = categoryLIst.Data.ToList();
toastService.ShowSuccess("Fetch successfully"); …
Run Code Online (Sandbox Code Playgroud)