使用Postman-grpc,我需要将文件作为请求(通过Postman)上传到我的GRPC-Server

问题描述 投票:0回答:1

I have a GRPC file-upload server(C#) running and I also have GRPC-client through which I was uploading files to the GRPC server but now I want to upload my file using postman(yes the new postman version supports GRPC) and now I am not able to figure out how to attach/send the file via the GRPC-postman to my GRPC-server ,for example in REST-postman u r able attach the file in body using form-data选项卡。任何人都可以给我解决这个问题吗?

谢谢你

asp.net-core postman grpc grpc-web grpc-c#
1个回答
0
投票
,例如,对于以下原始文件:

syntax = "proto3"; option csharp_namespace = "YourNamespace.Grpc"; package filestorage; service FileStorageService { rpc UploadFile (UploadFileRequest) returns (UploadFileResponse); } message UploadFileRequest { bytes fileData = 1; string contentType = 2; string originalFileName = 3; } message UploadFileResponse { string fileName = 1; }

您可以在Postman中写下以下构造:


总而言,此方法将文件编码为base64,以便您的GRPC服务器可以将其解码为字节。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.