Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a POST example #754

Closed
profnimrod opened this issue Feb 5, 2020 · 6 comments
Closed

Provide a POST example #754

profnimrod opened this issue Feb 5, 2020 · 6 comments
Labels
question Further information is requested

Comments

@profnimrod
Copy link

profnimrod commented Feb 5, 2020

I having trouble getting a POST example to work for a custom object. The proto looks like:

rpc registerTerminal(RegisterTerminalRequest) returns (RegisterTerminalResponse) {
		option (google.api.http) = {
		  post: "ks/api/registerterminal",
		  body: "*"
		};
	  }

and the corresponding service override method looks like:

public class TerminalGatewayHighPriorityService : TerminalGatewayHighPriorityAPI.TerminalGatewayHighPriorityAPIBase
    {
        private readonly ILogger _logger;

        public TerminalGatewayHighPriorityService(ILoggerFactory loggerFactory)
        {
            _logger = loggerFactory.CreateLogger<TerminalGatewayHighPriorityService>();
        }

        public override Task<RegisterTerminalResponse> registerTerminal(RegisterTerminalRequest request, ServerCallContext context)
        {
            _logger.LogInformation($"Processing terminal registration request {request.TerminalId}");
            return Task.FromResult(new RegisterTerminalResponse());
        }
    }

Any ideas on what I'm doing wrong?

@profnimrod profnimrod added the question Further information is requested label Feb 5, 2020
@JamesNK
Copy link
Member

JamesNK commented Feb 5, 2020

That isn't supported directly. You can use grpc-gateway, or track this issue for how to do it directly in .NET - #167

@JamesNK JamesNK closed this as completed Feb 5, 2020
@profnimrod
Copy link
Author

Thanks. I'm aware of grpc-gateway, but I'm working with .NET Core, not Go. Just to confirm, you're saying that the only supported HTTP verb with this library (GrpcHttpApi) is "GET"? The issue you suggest I track points to https://github.com/aspnet/AspLabs/tree/master/src/GrpcHttpApi which is what my initial post is referring to. Is supporting other verbs on the near-term roadmap for that library?

@JamesNK
Copy link
Member

JamesNK commented Feb 5, 2020

It supports all verbs. Why do you think it only supports GET?

@profnimrod
Copy link
Author

Because I asked for an example with POST and you said "that isn't directly supported"... We might be talking passed each other. My question is concerned with the GrpcHttpApi library you pointed me to last week, which I have been trying to get to grips with.

@JamesNK
Copy link
Member

JamesNK commented Feb 5, 2020

Ok. It isn't directly supported in the publicly released and supported Grpc.AspNetCore framework. Experimental support is in GrpcHttpApi.

@profnimrod
Copy link
Author

Thanks for the clarification. So back to my original query: how is POST done with GrpcHttpApi. I'm having trouble getting it working and a simple example would probably be sufficient to get me on the right track.

FYI The link for feedback at the bottom of https://github.com/aspnet/AspLabs/tree/master/src/GrpcHttpApi points to the transcoding issue you mentioned above. It was not clear to me whether you're expecting all feedback for GrpcHttpApi to be posted to that single issue, or to the grpc-dotnet issues in general. Apols if I've misinterpreted the intention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants