admin管理员组文章数量:1410705
I have an API that is using MagicOnion and MessagePack in .NET. I am using swagger like this:
public static IServiceCollection AddMagicOnionServices(this IServiceCollection services)
{
services.AddMagicOnion();
MessagePackSerializer.DefaultOptions =
MessagePackSerializerOptions.Standard.WithResolver(
CompositeResolver.Create(
ContractlessStandardResolver.Instance,
StandardResolver.Instance));
services.AddApiVersioning(o =>
{
o.DefaultApiVersion = new ApiVersion(1, 0);
o.AssumeDefaultVersionWhenUnspecified = false;
o.RouteConstraintName = "apiVersion";
o.ApiVersionReader = new UrlSegmentApiVersionReader();
o.ReportApiVersions = true;
})
.AddMvc()
.AddApiExplorer(
o =>
{
// ReSharper disable once StringLiteralTypo
o.GroupNameFormat = "'v'VVV";
o.SubstituteApiVersionInUrl = true;
});
services.AddSwaggerGen(
options =>
{
options.AddEnumsWithValuesFixFilters().EnableAnnotations(true, true);
if (Assembly.GetExecutingAssembly().Location is { } location)
{
options.IncludeXmlComments(Path.ChangeExtension(location, ".xml"));
options.IncludeGrpcXmlComments(Path.ChangeExtension(location, ".xml"), true);
}
});
return services;
}
public static void UseAppSwagger(this WebApplication app)
{
app.UseSwagger(o => o.RouteTemplate = "/swagger-rest/{documentName}/swagger.json");
app.UseSwaggerUI(o => o.RoutePrefix = "swagger-rest");
}
I am able to open swagger and send requests :
But how to import it or use endpoints from Postman? Before when API was using protobuf instead of MessagePack, I was able to import protobufs in postman and send request using Grpc
版权声明:本文标题:asp.net web api - How to send request to API that uses MessagePack with MagicOnion using Postman - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744994851a2636609.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论