Skip to content

Handling custom headers on the server  #42

Description

@Baryshych

Hi! I have an issue with my js client sending requests with custom metadata:

commentsClient.getComments(request, metadata, function (err, res) {

I'm using lazy init (as shown in README)

  GRPCWeb.handle(CommentsService::Service) do
    require_relative '../../app/grpc/services/comments_service.rb'
    GetCommentsService.new
  end

and my _call argument is always nil

def get_comments(request, _call = nil)
    return CommentResponse.new(comment: "Hello #{request.resourceId}")

As I have seen in the Golang implementation of GRPC-web, they access headers through the _call argument. I've briefly read sources (so I might be completely wrong, sorry in advance), and its look like

Is it possible to access env or headers is the service implementation?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions